@uniqbit/mate-core 0.15.5-canary.2 → 0.15.5-canary.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniqbit/mate-core",
3
- "version": "0.15.5-canary.2",
3
+ "version": "0.15.5-canary.3",
4
4
  "description": "Core framework and plugin APIs for Mate.",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -126,13 +126,25 @@ export async function executeSetupInstallationPlan(
126
126
  });
127
127
 
128
128
  for (const action of plan.actions) {
129
- if (ctx.scope === "hub" && action.phase !== "provider") continue;
130
-
131
129
  const plugin = pluginById.get(action.pluginId);
132
130
  if (!plugin) {
133
131
  continue;
134
132
  }
135
133
 
134
+ if (ctx.scope === "hub" && action.phase !== "provider") {
135
+ if (action.phase === "capability" && !action.providerId) {
136
+ const capability = plugin as CapabilityPlugin;
137
+ const hubHandler = action.action === "apply" ? capability.applyHub : capability.teardownHub;
138
+ if (hubHandler) {
139
+ mediator.track(action.pluginId);
140
+ const actionCtx: SetupContext = { ...ctx, ...mediator.servicesFor(action.pluginId) };
141
+ await hubHandler(actionCtx);
142
+ executedActions.push(action);
143
+ }
144
+ }
145
+ continue;
146
+ }
147
+
136
148
  if (action.skipReason) {
137
149
  skippedActions.push(action);
138
150
  const warning = `${action.pluginId} capability disabled: ${action.skipReason}`;
@@ -228,4 +228,11 @@ export interface CapabilityPlugin extends Plugin {
228
228
  preflight?(ctx: LaunchPreflightContext): Promise<string[]>;
229
229
  }
230
230
  >;
231
+ /**
232
+ * Hub-scope counterparts to apply/teardown. The engine calls these instead
233
+ * of apply/teardown when ctx.scope === "hub", never in addition. Absent
234
+ * hooks keep the capability-phase action skipped for hub scope, unchanged.
235
+ */
236
+ applyHub?(ctx: SetupContext): Promise<void>;
237
+ teardownHub?(ctx: SetupContext): Promise<void>;
231
238
  }