@lesliechan721/aw 0.1.0-beta.83 → 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.
Files changed (179) hide show
  1. package/dist/authoring/assets/aw-runtime-config.mjs +1 -1
  2. package/dist/authoring/assets/aw-runtime-config.mjs.map +1 -1
  3. package/dist/src/commands/console.js +1 -0
  4. package/dist/src/commands/console.js.map +1 -1
  5. package/dist/src/commands/intent-command.d.ts +1 -0
  6. package/dist/src/commands/intent-command.js +6 -2
  7. package/dist/src/commands/intent-command.js.map +1 -1
  8. package/dist/src/commands/plugin-capabilities.js +3 -3
  9. package/dist/src/commands/plugin-capabilities.js.map +1 -1
  10. package/dist/src/commands/public-lifecycle-result.d.ts +11 -5
  11. package/dist/src/commands/public-lifecycle-result.js +131 -46
  12. package/dist/src/commands/public-lifecycle-result.js.map +1 -1
  13. package/dist/src/commands/public-lifecycle.d.ts +1 -2
  14. package/dist/src/commands/public-lifecycle.js +56 -34
  15. package/dist/src/commands/public-lifecycle.js.map +1 -1
  16. package/dist/src/commands/public-plugin-query.js +28 -11
  17. package/dist/src/commands/public-plugin-query.js.map +1 -1
  18. package/dist/src/commands/rebuild-command.d.ts +13 -3
  19. package/dist/src/commands/rebuild-command.js +647 -286
  20. package/dist/src/commands/rebuild-command.js.map +1 -1
  21. package/dist/src/commands/rebuild-integration.d.ts +5 -2
  22. package/dist/src/commands/rebuild-integration.js +55 -29
  23. package/dist/src/commands/rebuild-integration.js.map +1 -1
  24. package/dist/src/commands/rebuild-operations.d.ts +1 -0
  25. package/dist/src/commands/rebuild-operations.js +23 -4
  26. package/dist/src/commands/rebuild-operations.js.map +1 -1
  27. package/dist/src/commands/rebuild-platform-integration.d.ts +13 -3
  28. package/dist/src/commands/rebuild-platform-integration.js +229 -133
  29. package/dist/src/commands/rebuild-platform-integration.js.map +1 -1
  30. package/dist/src/index.js +105 -50
  31. package/dist/src/index.js.map +1 -1
  32. package/dist/src/output/public-result.d.ts +2 -0
  33. package/dist/src/output/public-result.js +43 -6
  34. package/dist/src/output/public-result.js.map +1 -1
  35. package/dist/src/output/rebuild-progress.d.ts +3 -0
  36. package/dist/src/output/rebuild-progress.js +12 -2
  37. package/dist/src/output/rebuild-progress.js.map +1 -1
  38. package/dist/src/output/receipt-projection.js +55 -18
  39. package/dist/src/output/receipt-projection.js.map +1 -1
  40. package/dist/src/output/skill-invocation-notices.d.ts +16 -0
  41. package/dist/src/output/skill-invocation-notices.js +48 -0
  42. package/dist/src/output/skill-invocation-notices.js.map +1 -0
  43. package/dist/src/platforms/capabilities.d.ts +2 -0
  44. package/dist/src/platforms/capabilities.js +73 -34
  45. package/dist/src/platforms/capabilities.js.map +1 -1
  46. package/dist/src/platforms/contracts.d.ts +9 -9
  47. package/dist/src/platforms/discovery.d.ts +0 -7
  48. package/dist/src/platforms/discovery.js +13 -53
  49. package/dist/src/platforms/discovery.js.map +1 -1
  50. package/dist/src/platforms/inspection-native.js +1 -80
  51. package/dist/src/platforms/inspection-native.js.map +1 -1
  52. package/dist/src/platforms/inspection-query.d.ts +2 -3
  53. package/dist/src/platforms/inspection-query.js +7 -18
  54. package/dist/src/platforms/inspection-query.js.map +1 -1
  55. package/dist/src/platforms/inspection.js +2 -2
  56. package/dist/src/platforms/inspection.js.map +1 -1
  57. package/dist/src/platforms/layout.js +1 -5
  58. package/dist/src/platforms/layout.js.map +1 -1
  59. package/dist/src/platforms/lifecycle-native-services.d.ts +1 -1
  60. package/dist/src/platforms/lifecycle-native-services.js +14 -14
  61. package/dist/src/platforms/lifecycle-native-services.js.map +1 -1
  62. package/dist/src/platforms/lifecycle-native.js +4 -88
  63. package/dist/src/platforms/lifecycle-native.js.map +1 -1
  64. package/dist/src/platforms/lifecycle.js +56 -56
  65. package/dist/src/platforms/lifecycle.js.map +1 -1
  66. package/dist/src/platforms/projection-code-extension.js +7 -3
  67. package/dist/src/platforms/projection-code-extension.js.map +1 -1
  68. package/dist/src/platforms/projection.d.ts +3 -0
  69. package/dist/src/platforms/projection.js +86 -54
  70. package/dist/src/platforms/projection.js.map +1 -1
  71. package/dist/src/portable/materializer.js +2 -2
  72. package/dist/src/portable/materializer.js.map +1 -1
  73. package/dist/src/portable/recovery.d.ts +29 -3
  74. package/dist/src/portable/recovery.js +220 -78
  75. package/dist/src/portable/recovery.js.map +1 -1
  76. package/dist/src/recovery/coordinator.d.ts +18 -4
  77. package/dist/src/recovery/coordinator.js +357 -165
  78. package/dist/src/recovery/coordinator.js.map +1 -1
  79. package/dist/src/recovery/install-concurrency.d.ts +48 -0
  80. package/dist/src/recovery/install-concurrency.js +195 -0
  81. package/dist/src/recovery/install-concurrency.js.map +1 -0
  82. package/dist/src/recovery/interruption.d.ts +19 -0
  83. package/dist/src/recovery/interruption.js +43 -0
  84. package/dist/src/recovery/interruption.js.map +1 -0
  85. package/dist/src/recovery/joint-coordinator.d.ts +11 -4
  86. package/dist/src/recovery/joint-coordinator.js +671 -333
  87. package/dist/src/recovery/joint-coordinator.js.map +1 -1
  88. package/dist/src/recovery/joint-demand.d.ts +8 -0
  89. package/dist/src/recovery/joint-demand.js +52 -1
  90. package/dist/src/recovery/joint-demand.js.map +1 -1
  91. package/dist/src/recovery/joint-install-execution.d.ts +19 -0
  92. package/dist/src/recovery/joint-install-execution.js +307 -0
  93. package/dist/src/recovery/joint-install-execution.js.map +1 -0
  94. package/dist/src/recovery/joint-install-native-rebase.d.ts +4 -0
  95. package/dist/src/recovery/joint-install-native-rebase.js +67 -0
  96. package/dist/src/recovery/joint-install-native-rebase.js.map +1 -0
  97. package/dist/src/recovery/receipt.d.ts +20 -0
  98. package/dist/src/recovery/receipt.js +67 -1
  99. package/dist/src/recovery/receipt.js.map +1 -1
  100. package/dist/src/recovery/retirement.js +1 -1
  101. package/dist/src/recovery/retirement.js.map +1 -1
  102. package/dist/src/recovery/status.js +26 -27
  103. package/dist/src/recovery/status.js.map +1 -1
  104. package/dist/src/review/platform-profile.d.ts +4 -1
  105. package/dist/src/review/platform-profile.js +13 -4
  106. package/dist/src/review/platform-profile.js.map +1 -1
  107. package/dist/src/review/skill-materialization.d.ts +1 -0
  108. package/dist/src/review/skill-materialization.js +28 -16
  109. package/dist/src/review/skill-materialization.js.map +1 -1
  110. package/dist/src/review/source-binding.js +6 -4
  111. package/dist/src/review/source-binding.js.map +1 -1
  112. package/dist/src/tui/console-app-v4.d.ts +1 -1
  113. package/dist/src/tui/console-app-v4.js +137 -57
  114. package/dist/src/tui/console-app-v4.js.map +1 -1
  115. package/dist/src/tui/controller-runtime.js +45 -9
  116. package/dist/src/tui/controller-runtime.js.map +1 -1
  117. package/dist/src/tui/controller.d.ts +13 -4
  118. package/dist/src/tui/controller.js +233 -102
  119. package/dist/src/tui/controller.js.map +1 -1
  120. package/dist/src/tui/deployment-view.js +6 -1
  121. package/dist/src/tui/deployment-view.js.map +1 -1
  122. package/dist/src/tui/diagnostic-projection.d.ts +4 -2
  123. package/dist/src/tui/diagnostic-projection.js +40 -4
  124. package/dist/src/tui/diagnostic-projection.js.map +1 -1
  125. package/dist/src/tui/operation-diagnostic-screens.d.ts +1 -1
  126. package/dist/src/tui/operation-diagnostic-screens.js +3 -1
  127. package/dist/src/tui/operation-diagnostic-screens.js.map +1 -1
  128. package/dist/src/tui/operation-history.d.ts +6 -3
  129. package/dist/src/tui/operation-history.js +15 -2
  130. package/dist/src/tui/operation-history.js.map +1 -1
  131. package/dist/src/tui/scoped-flow.d.ts +3 -1
  132. package/dist/src/tui/scoped-flow.js +99 -1
  133. package/dist/src/tui/scoped-flow.js.map +1 -1
  134. package/dist/src/tui/session-console-app.d.ts +2 -0
  135. package/dist/src/tui/session-console-app.js +11 -0
  136. package/dist/src/tui/session-console-app.js.map +1 -1
  137. package/dist/src/types.d.ts +8 -1
  138. package/dist/src/types.js.map +1 -1
  139. package/dist/src/utils/aw-home-mutation-lock.js +2 -1
  140. package/dist/src/utils/aw-home-mutation-lock.js.map +1 -1
  141. package/dist/src/utils/catalog-source-references.js +2 -14
  142. package/dist/src/utils/catalog-source-references.js.map +1 -1
  143. package/dist/src/utils/component-resources.js +1 -1
  144. package/dist/src/utils/component-resources.js.map +1 -1
  145. package/dist/src/utils/managed-command-materialization.d.ts +2 -1
  146. package/dist/src/utils/managed-command-materialization.js +3 -3
  147. package/dist/src/utils/managed-command-materialization.js.map +1 -1
  148. package/dist/src/utils/managed-command-store.d.ts +6 -0
  149. package/dist/src/utils/managed-command-store.js +90 -18
  150. package/dist/src/utils/managed-command-store.js.map +1 -1
  151. package/dist/src/utils/multi-source-catalog.d.ts +2 -0
  152. package/dist/src/utils/multi-source-catalog.js +3 -2
  153. package/dist/src/utils/multi-source-catalog.js.map +1 -1
  154. package/dist/src/utils/native-cli.d.ts +0 -19
  155. package/dist/src/utils/native-cli.js +2 -42
  156. package/dist/src/utils/native-cli.js.map +1 -1
  157. package/dist/src/utils/ownership.js +1 -1
  158. package/dist/src/utils/ownership.js.map +1 -1
  159. package/dist/src/utils/platform-empty-state.d.ts +1 -3
  160. package/dist/src/utils/platform-empty-state.js +1 -6
  161. package/dist/src/utils/platform-empty-state.js.map +1 -1
  162. package/dist/src/utils/plugin-config-write.d.ts +8 -0
  163. package/dist/src/utils/plugin-config-write.js +89 -25
  164. package/dist/src/utils/plugin-config-write.js.map +1 -1
  165. package/dist/src/utils/plugin-scripts.js +5 -0
  166. package/dist/src/utils/plugin-scripts.js.map +1 -1
  167. package/dist/src/utils/skill-invocation-warning.d.ts +15 -0
  168. package/dist/src/utils/skill-invocation-warning.js +42 -0
  169. package/dist/src/utils/skill-invocation-warning.js.map +1 -0
  170. package/package.json +3 -3
  171. package/dist/src/output/native-consent.d.ts +0 -2
  172. package/dist/src/output/native-consent.js +0 -5
  173. package/dist/src/output/native-consent.js.map +0 -1
  174. package/dist/src/platforms/gemini-activation.d.ts +0 -36
  175. package/dist/src/platforms/gemini-activation.js +0 -331
  176. package/dist/src/platforms/gemini-activation.js.map +0 -1
  177. package/dist/src/platforms/gemini-consent.d.ts +0 -8
  178. package/dist/src/platforms/gemini-consent.js +0 -81
  179. package/dist/src/platforms/gemini-consent.js.map +0 -1
@@ -14,15 +14,16 @@ 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';
@@ -1934,7 +1935,16 @@ export function createTuiControllerDependencies(context, progressFeed, options =
1934
1935
  const refreshed = await activateRecoverySourcesAndReprepare(plan.plan, { runtime: context });
1935
1936
  return { kind: 'recoveryReview', plan: { kind: 'recovery', scope: plan.scope, plan: refreshed } };
1936
1937
  }
1937
- const receipt = await executeRecovery(plan.plan, { yes: true, runtime: context });
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
+ });
1938
1948
  return { kind: 'recovery', receipt };
1939
1949
  },
1940
1950
  loadPluginContent,
@@ -2645,7 +2655,15 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2645
2655
  const approvedPreApplyTargets = reviewedBatch.groups.flatMap((group) => group.config.preApplyAuthorization ?? []);
2646
2656
  const results = [];
2647
2657
  const packageInfo = await readCliPackageInfo();
2658
+ let interrupted = false;
2648
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
+ }
2649
2667
  const groupIntent = configSaveBatchGroupIntent(intent, group);
2650
2668
  const reviewedGroup = reviewedBatch.groups.find((item) => item.platform === group.platform);
2651
2669
  if (!reviewedGroup) {
@@ -2741,15 +2759,16 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2741
2759
  ? 'succeeded'
2742
2760
  : result.apply.state === 'skipped'
2743
2761
  ? 'notNeeded'
2744
- : 'failed';
2762
+ : configApplyHasCompletedWork(result.apply) ? 'partial' : 'failed';
2763
+ const applyIncomplete = applyStatus === 'failed' || applyStatus === 'partial';
2745
2764
  results.push({
2746
2765
  scope: 'user', platform: group.platform,
2747
- status: applyStatus === 'failed' ? 'failed' : 'succeeded',
2766
+ status: applyIncomplete ? 'failed' : 'succeeded',
2748
2767
  configSaved,
2749
2768
  applyRequested: intent.apply,
2750
2769
  applyStatus,
2751
2770
  execution: { ...result, operationRebuildResults },
2752
- ...(applyStatus === 'failed' ? {
2771
+ ...(applyIncomplete ? {
2753
2772
  errorCode: result.apply.state === 'unavailable'
2754
2773
  ? result.apply.error?.code ?? result.apply.reason
2755
2774
  : result.apply.targetResults.find((target) => target.errorCode)?.errorCode
@@ -2758,6 +2777,13 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2758
2777
  });
2759
2778
  }
2760
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
+ }
2761
2787
  configSaved = error?.configWrite === 'succeeded';
2762
2788
  const errorCode = typeof error === 'object' && error !== null
2763
2789
  && 'code' in error && typeof error.code === 'string'
@@ -2768,10 +2794,14 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2768
2794
  status: 'failed',
2769
2795
  configSaved,
2770
2796
  applyRequested: intent.apply,
2771
- applyStatus: intent.apply ? 'failed' : 'notRequested',
2797
+ applyStatus: !intent.apply ? 'notRequested'
2798
+ : configApplyHasCompletedWork(interruption?.apply) ? 'partial' : 'failed',
2772
2799
  errorCode,
2773
- ...(operationRebuildResults.length > 0
2774
- ? { execution: { operationRebuildResults } }
2800
+ ...(interruption || operationRebuildResults.length > 0
2801
+ ? { execution: {
2802
+ operationRebuildResults,
2803
+ ...(interruption ? { apply: interruption.apply, operationDiagnostic: interruption.operationDiagnostic } : {}),
2804
+ } }
2775
2805
  : {}),
2776
2806
  });
2777
2807
  }
@@ -2893,6 +2923,12 @@ export function createTuiControllerDependencies(context, progressFeed, options =
2893
2923
  });
2894
2924
  return { ...result, operationRebuildResults };
2895
2925
  },
2926
+ }).catch((error) => {
2927
+ if (error instanceof ConfigApplyInterruptedError && context.interruption
2928
+ && error.code === 'processCleanupUnconfirmed') {
2929
+ context.interruption.cleanupFailed = true;
2930
+ }
2931
+ throw error;
2896
2932
  });
2897
2933
  }
2898
2934
  throw new TuiOperationBlockedError('operationNotImplemented', '这个写操作尚未接入新 Controller。');