@lesliechan721/aw 0.1.0-beta.53 → 0.1.0-beta.55

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 (111) hide show
  1. package/dist/authoring/scripts/lib/plugin-version-check.mjs +1 -1
  2. package/dist/authoring/scripts/validate-plugin.mjs +208 -31
  3. package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
  4. package/dist/scripts/bundle-plugins.js +8 -3
  5. package/dist/scripts/bundle-plugins.js.map +1 -1
  6. package/dist/src/adapters/helpers.d.ts +7 -0
  7. package/dist/src/adapters/helpers.js.map +1 -1
  8. package/dist/src/commands/aw-capabilities.d.ts +1 -1
  9. package/dist/src/commands/aw-capabilities.js +2 -0
  10. package/dist/src/commands/aw-capabilities.js.map +1 -1
  11. package/dist/src/commands/managed-commands.d.ts +26 -0
  12. package/dist/src/commands/managed-commands.js +277 -0
  13. package/dist/src/commands/managed-commands.js.map +1 -0
  14. package/dist/src/commands/operation-plan.d.ts +30 -1
  15. package/dist/src/commands/operation-plan.js.map +1 -1
  16. package/dist/src/commands/operation-planner.d.ts +1 -0
  17. package/dist/src/commands/operation-planner.js +1 -0
  18. package/dist/src/commands/operation-planner.js.map +1 -1
  19. package/dist/src/commands/plugin-capabilities.js +29 -1
  20. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  21. package/dist/src/commands/rebuild-command.d.ts +2 -1
  22. package/dist/src/commands/rebuild-command.js +66 -26
  23. package/dist/src/commands/rebuild-command.js.map +1 -1
  24. package/dist/src/commands/rebuild-integration.d.ts +13 -1
  25. package/dist/src/commands/rebuild-integration.js +516 -61
  26. package/dist/src/commands/rebuild-integration.js.map +1 -1
  27. package/dist/src/commands/rebuild-operations.d.ts +3 -1
  28. package/dist/src/commands/rebuild-operations.js +9 -5
  29. package/dist/src/commands/rebuild-operations.js.map +1 -1
  30. package/dist/src/generators/local-plugin.js +16 -0
  31. package/dist/src/generators/local-plugin.js.map +1 -1
  32. package/dist/src/generators/permissions.d.ts +5 -2
  33. package/dist/src/generators/permissions.js +28 -15
  34. package/dist/src/generators/permissions.js.map +1 -1
  35. package/dist/src/index.js +11 -0
  36. package/dist/src/index.js.map +1 -1
  37. package/dist/src/output/command-receipt.d.ts +3 -1
  38. package/dist/src/output/command-receipt.js +30 -9
  39. package/dist/src/output/command-receipt.js.map +1 -1
  40. package/dist/src/output/rebuild-progress.js +14 -0
  41. package/dist/src/output/rebuild-progress.js.map +1 -1
  42. package/dist/src/portable/materializer.js +3 -0
  43. package/dist/src/portable/materializer.js.map +1 -1
  44. package/dist/src/review/skill-materialization.d.ts +14 -1
  45. package/dist/src/review/skill-materialization.js +138 -0
  46. package/dist/src/review/skill-materialization.js.map +1 -1
  47. package/dist/src/tui/console-app-v4.js +19 -7
  48. package/dist/src/tui/console-app-v4.js.map +1 -1
  49. package/dist/src/tui/controller-runtime.js +23 -9
  50. package/dist/src/tui/controller-runtime.js.map +1 -1
  51. package/dist/src/tui/controller.d.ts +5 -1
  52. package/dist/src/tui/controller.js +24 -3
  53. package/dist/src/tui/controller.js.map +1 -1
  54. package/dist/src/tui/diagnostic-projection.js +34 -6
  55. package/dist/src/tui/diagnostic-projection.js.map +1 -1
  56. package/dist/src/tui/operation-review-planner.js +102 -16
  57. package/dist/src/tui/operation-review-planner.js.map +1 -1
  58. package/dist/src/types.d.ts +22 -2
  59. package/dist/src/types.js.map +1 -1
  60. package/dist/src/utils/artifact-plan.d.ts +4 -3
  61. package/dist/src/utils/artifact-plan.js +50 -7
  62. package/dist/src/utils/artifact-plan.js.map +1 -1
  63. package/dist/src/utils/artifact-renderer.d.ts +7 -3
  64. package/dist/src/utils/artifact-renderer.js +19 -6
  65. package/dist/src/utils/artifact-renderer.js.map +1 -1
  66. package/dist/src/utils/artifact-request.d.ts +16 -5
  67. package/dist/src/utils/artifact-request.js +27 -15
  68. package/dist/src/utils/artifact-request.js.map +1 -1
  69. package/dist/src/utils/artifact-sources.d.ts +4 -0
  70. package/dist/src/utils/artifact-sources.js +17 -0
  71. package/dist/src/utils/artifact-sources.js.map +1 -1
  72. package/dist/src/utils/bundle-layout.js +7 -0
  73. package/dist/src/utils/bundle-layout.js.map +1 -1
  74. package/dist/src/utils/claude-skills-root.d.ts +8 -0
  75. package/dist/src/utils/claude-skills-root.js +76 -0
  76. package/dist/src/utils/claude-skills-root.js.map +1 -0
  77. package/dist/src/utils/codex-skills-root.d.ts +4 -0
  78. package/dist/src/utils/codex-skills-root.js +25 -0
  79. package/dist/src/utils/codex-skills-root.js.map +1 -0
  80. package/dist/src/utils/dynamic-skill-tree.d.ts +1 -0
  81. package/dist/src/utils/dynamic-skill-tree.js +25 -6
  82. package/dist/src/utils/dynamic-skill-tree.js.map +1 -1
  83. package/dist/src/utils/local-marketplace.d.ts +9 -0
  84. package/dist/src/utils/local-marketplace.js +170 -90
  85. package/dist/src/utils/local-marketplace.js.map +1 -1
  86. package/dist/src/utils/managed-command-closure.d.ts +3 -0
  87. package/dist/src/utils/managed-command-closure.js +35 -0
  88. package/dist/src/utils/managed-command-closure.js.map +1 -0
  89. package/dist/src/utils/managed-command-evidence.d.ts +7 -0
  90. package/dist/src/utils/managed-command-evidence.js +86 -0
  91. package/dist/src/utils/managed-command-evidence.js.map +1 -0
  92. package/dist/src/utils/managed-command-materialization.d.ts +106 -0
  93. package/dist/src/utils/managed-command-materialization.js +307 -0
  94. package/dist/src/utils/managed-command-materialization.js.map +1 -0
  95. package/dist/src/utils/managed-command-runtime.d.ts +32 -0
  96. package/dist/src/utils/managed-command-runtime.js +110 -0
  97. package/dist/src/utils/managed-command-runtime.js.map +1 -0
  98. package/dist/src/utils/managed-command-store.d.ts +120 -0
  99. package/dist/src/utils/managed-command-store.js +563 -0
  100. package/dist/src/utils/managed-command-store.js.map +1 -0
  101. package/dist/src/utils/ownership.d.ts +2 -0
  102. package/dist/src/utils/plugin-config-impact.d.ts +8 -1
  103. package/dist/src/utils/plugin-config-impact.js +101 -26
  104. package/dist/src/utils/plugin-config-impact.js.map +1 -1
  105. package/dist/src/utils/plugin-config-write.js +142 -60
  106. package/dist/src/utils/plugin-config-write.js.map +1 -1
  107. package/dist/src/utils/rendered-contract.js +18 -1
  108. package/dist/src/utils/rendered-contract.js.map +1 -1
  109. package/dist/src/utils/runtime-skill-closure.js +47 -6
  110. package/dist/src/utils/runtime-skill-closure.js.map +1 -1
  111. package/package.json +3 -3
@@ -15,7 +15,8 @@ import { coercePluginConfigUpdates, inspectPluginConfigResetTarget, listNamespac
15
15
  import { assertProjectSharedConfigPathVisible } from '../utils/project-boundary.js';
16
16
  import { calculatePluginIntentDigest, readPluginIntentState, } from '../utils/plugin-intent-state.js';
17
17
  import { applyPluginConfigWrite, replayConfigRuntimeWrites, resolveConfigPreApplyAuthorization, resetPluginConfigWithHelper, } from '../utils/plugin-config-write.js';
18
- import { analyzePluginConfigMutationImpact } from '../utils/plugin-config-impact.js';
18
+ import { analyzePluginConfigMutationImpact, pluginSharedNativeConfigTargets } from '../utils/plugin-config-impact.js';
19
+ import { discoverInstalledPluginManagedCommandPackages } from '../utils/managed-command-materialization.js';
19
20
  import { createBatchIntentCompatiblePlanFingerprint } from '../commands/operation-plan.js';
20
21
  import { inventoryCatalogSourceReferences } from '../utils/catalog-source-references.js';
21
22
  import { operationEvidenceMatches, operationEvidenceFingerprint, TuiConfigInvalidStoreError, TuiController, TuiOperationBlockedError, } from './controller.js';
@@ -130,13 +131,7 @@ export function configAffectedStatusTargets(targets, pluginId, configScope) {
130
131
  .localeCompare(`${right.platform}\0${right.scope}`, 'en'));
131
132
  }
132
133
  function configRetrySharedNativeRenderTargets(plugin) {
133
- return (plugin.manifest.artifacts?.targets ?? []).flatMap((target) => target.platform === 'codex'
134
- && target.target === 'codex.skill'
135
- && target.delivery.mode === 'codex-native'
136
- && target.skillKey
137
- && target.refreshKeys.length > 0
138
- ? [{ id: target.id, skillKey: target.skillKey, refreshKeys: [...target.refreshKeys] }]
139
- : []);
134
+ return pluginSharedNativeConfigTargets(plugin);
140
135
  }
141
136
  function configImpactVisibleTargets(pluginName, targets) {
142
137
  return targets.map((target) => ({
@@ -1081,6 +1076,8 @@ export function createTuiControllerDependencies(context, progressFeed, options =
1081
1076
  storeDigest: selected?.impact.storeDigest ?? target.fingerprint,
1082
1077
  impactState: selected?.impact.impactState ?? 'unknown',
1083
1078
  ...(selected?.impact.noEffectiveChange ? { noEffectiveChange: true } : {}),
1079
+ ...(selected?.impact.affectedCommandPackages.length
1080
+ ? { commandPackages: selected.impact.affectedCommandPackages } : {}),
1084
1081
  affectedTargets: (selected?.impact.affectedTargets
1085
1082
  ?? relevantTargets).map(({ platform, scope }) => ({ platform, scope })),
1086
1083
  ...((selected?.impact.sharedNativeRenderTargets.length ?? 0) > 0
@@ -2187,10 +2184,14 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2187
2184
  const affectedTargets = intent.retryApply
2188
2185
  ? configImpactVisibleTargets(plugin.manifest.name, relevantTargets)
2189
2186
  : impact.affectedTargets;
2187
+ const commandPackages = impact?.affectedCommandPackages
2188
+ ?? (await discoverInstalledPluginManagedCommandPackages({ plugin, scope: intent.scope,
2189
+ cwd: context.cwd, env: context.env ?? process.env, platformTargets: affectedTargets })).packages;
2190
2190
  return {
2191
2191
  pluginName: plugin.manifest.name,
2192
2192
  source: sourceEvidenceForPlugin(source, plugin.manifest.name),
2193
2193
  impact,
2194
+ commandPackages,
2194
2195
  preApplyAuthorization: configIntentRequestsApply(intent)
2195
2196
  ? (await resolveConfigPreApplyAuthorization({
2196
2197
  plugin,
@@ -2241,6 +2242,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2241
2242
  ?? digest({ exists: retryStore?.exists, rawDigest: retryStore?.rawDigest }),
2242
2243
  impactState: selected.impact?.impactState ?? 'known',
2243
2244
  ...(selected.impact?.noEffectiveChange ? { noEffectiveChange: true } : {}),
2245
+ ...(selected.commandPackages.length ? { commandPackages: selected.commandPackages } : {}),
2244
2246
  affectedTargets: (selected.impact?.affectedTargets
2245
2247
  ?? relevantTargets).map(({ platform, scope }) => ({ platform, scope })),
2246
2248
  ...(selected.preApplyAuthorization.length > 0
@@ -2340,6 +2342,11 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2340
2342
  pluginName: plugin.manifest.name,
2341
2343
  source: sourceEvidenceForPlugin(source, plugin.manifest.name),
2342
2344
  impact,
2345
+ commandPackages: impact?.affectedCommandPackages
2346
+ ?? (intent.kind === 'configSave' ? (await discoverInstalledPluginManagedCommandPackages({
2347
+ plugin, scope: intent.scope, cwd: context.cwd, env: context.env ?? process.env,
2348
+ platformTargets: configImpactVisibleTargets(plugin.manifest.name, configVisibleTargets),
2349
+ })).packages : []),
2343
2350
  preApplyAuthorization: intent.kind === 'configSave'
2344
2351
  && configIntentRequestsApply(intent)
2345
2352
  ? (await resolveConfigPreApplyAuthorization({
@@ -2516,6 +2523,8 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2516
2523
  ?? digest({ exists: retryStore?.exists, rawDigest: retryStore?.rawDigest }),
2517
2524
  impactState: impact?.impactState ?? 'known',
2518
2525
  ...(impact?.noEffectiveChange ? { noEffectiveChange: true } : {}),
2526
+ ...('commandPackages' in selected && selected.commandPackages.length
2527
+ ? { commandPackages: selected.commandPackages } : {}),
2519
2528
  affectedTargets: (impact?.affectedTargets
2520
2529
  ?? evidenceTargets).map(({ platform, scope }) => ({ platform, scope })),
2521
2530
  ...(intent.scope === 'project' ? {
@@ -3281,6 +3290,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
3281
3290
  action: async (awHomeMutationToken) => {
3282
3291
  await tuiControllerRuntimeTestHooks?.beforeMutationEvidenceCapture?.();
3283
3292
  const operationInventory = createOperationInventoryReader();
3293
+ const managedCommandProducerCache = new Map();
3284
3294
  let currentEvidence;
3285
3295
  try {
3286
3296
  currentEvidence = await captureEvidence(intent, undefined, undefined, operationInventory, true, undefined, codexObservationSession, intent.kind === 'pluginWriteBatch'
@@ -3422,6 +3432,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
3422
3432
  ...context,
3423
3433
  awHomeMutationToken,
3424
3434
  preApplyConfirmed: true,
3435
+ managedCommandProducerCache,
3425
3436
  inventoryCatalogSourceReferences: groupInventory,
3426
3437
  ...(intent.action === 'cleanup' ? {} : {
3427
3438
  expectedCatalogConfigDigest: expectedBatch.catalog.configDigest,
@@ -3566,6 +3577,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
3566
3577
  inventoryCatalogSourceReferences: sourceInventory,
3567
3578
  preApplyConfirmed: true,
3568
3579
  preApplyExecutionCache,
3580
+ managedCommandProducerCache,
3569
3581
  ...(executionPreview.operationPlan
3570
3582
  ? { expectedPlanFingerprint: executionPreview.operationPlan.planFingerprint } : {}),
3571
3583
  ...(requiresManagedCodex ? { managedCodexAuthorizer: async () => true } : {}),
@@ -3687,6 +3699,7 @@ export function createTuiControllerDependencies(context, progressFeed, options =
3687
3699
  throw operationReviewStale('确认信息缺少设置批次证据。');
3688
3700
  }
3689
3701
  const approvedApplyTargets = new Set(reviewedBatch.groups.flatMap((group) => group.config.affectedTargets.map((target) => `${target.platform}\0${target.scope}`)));
3702
+ const approvedCommandPackages = new Set(reviewedBatch.groups.flatMap((group) => (group.config.commandPackages ?? []).map((target) => target.packageId)));
3690
3703
  const approvedPreApplyTargets = reviewedBatch.groups.flatMap((group) => group.config.preApplyAuthorization ?? []);
3691
3704
  const results = [];
3692
3705
  const packageInfo = await readCliPackageInfo();
@@ -3716,7 +3729,8 @@ export function createTuiControllerDependencies(context, progressFeed, options =
3716
3729
  if (freshLayerStoreDigest !== reviewedGroup.config.storeDigest) {
3717
3730
  throw operationReviewStale('保存设置期间此设置层的原始内容发生变化。');
3718
3731
  }
3719
- if (freshConfig.affectedTargets.some((target) => !approvedApplyTargets.has(`${target.platform}\0${target.scope}`))) {
3732
+ if (freshConfig.affectedTargets.some((target) => !approvedApplyTargets.has(`${target.platform}\0${target.scope}`))
3733
+ || freshConfig.commandPackages?.some((target) => !approvedCommandPackages.has(target.packageId))) {
3720
3734
  throw operationReviewStale('同批前一层变更扩大了未经确认的应用目标。');
3721
3735
  }
3722
3736
  const groupCatalogOperation = catalogOperationByEvidence.get(freshEvidence);