@lifeaitools/clauth 1.30.12 → 1.30.13

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.
@@ -140,6 +140,10 @@ export function validatePluginManifest(manifest, sourcePath = "") {
140
140
  id,
141
141
  version,
142
142
  publisher: String(manifest.publisher || "unknown"),
143
+ // Only trusted managed manifests may opt into automatic startup. User
144
+ // plugins remain awaiting_enable until an operator explicitly enables them.
145
+ core: manifest.core === true,
146
+ enable_default: manifest.enable_default === true,
143
147
  sourcePath,
144
148
  destination: normalizeDestination(manifest.destination),
145
149
  lifecycle_owner: normalizeLifecycleOwner(manifest.lifecycle_owner),
@@ -226,15 +230,17 @@ export function discoverPlugins() {
226
230
  throw new Error("user plugin cannot silently shadow a managed plugin id");
227
231
  }
228
232
  const prior = byId.get(manifest.id);
229
- const state = prior?.enabled ? (prior.manifest_hash === hash ? "current" : "version_drift") : "awaiting_enable";
230
- const plugin = { ...manifest, source, discovery_root: root, manifest_hash: hash, state, enabled: Boolean(prior?.enabled), discovered_at: now() };
233
+ const autoEnabled = source === "managed" && manifest.core === true && manifest.enable_default === true;
234
+ const enabled = Boolean(prior?.enabled || autoEnabled);
235
+ const state = enabled ? (prior?.manifest_hash === hash || autoEnabled ? "current" : "version_drift") : "awaiting_enable";
236
+ const plugin = { ...manifest, source, discovery_root: root, manifest_hash: hash, state, enabled, discovered_at: now() };
231
237
  plugins.push(plugin);
232
238
  for (const surface of plugin.surfaces) surfaces.push({ ...surface, enabled: plugin.enabled, state });
233
239
  for (const credential of plugin.credentials) {
234
240
  events.push({ kind: "credential_required", plugin_id: plugin.id, credential, value_set: false });
235
241
  }
236
242
  seen.add(plugin.id);
237
- events.push({ kind: "plugin_discovered", plugin_id: plugin.id, state, source, manifest_hash: hash });
243
+ events.push({ kind: autoEnabled && !prior?.enabled ? "core_plugin_auto_enabled" : "plugin_discovered", plugin_id: plugin.id, state, source, manifest_hash: hash });
238
244
  } catch (error) {
239
245
  const id = path.basename(path.dirname(manifestPath));
240
246
  plugins.push({
@@ -109,6 +109,24 @@ test("discovery merges managed and user roots without silent managed-id shadowin
109
109
  assert.match(invalid.error, /shadow/);
110
110
  }));
111
111
 
112
+ test("trusted managed core plugins auto-enable while user plugins remain opt-in", () => withTempSupervisor((root) => {
113
+ const managed = path.join(root, "managed");
114
+ const user = path.join(root, "user");
115
+ process.env.CLAUTH_MANAGED_PLUGIN_ROOTS = managed;
116
+ process.env.CLAUTH_USER_PLUGIN_ROOTS = user;
117
+ writePlugin(root, "managed", "core-mcp", baseManifest("core-mcp", { core: true, enable_default: true }));
118
+ writePlugin(root, "user", "user-mcp", baseManifest("user-mcp", { core: true, enable_default: true }));
119
+
120
+ const result = discoverPlugins();
121
+ const core = result.plugins.find((plugin) => plugin.id === "core-mcp");
122
+ const userPlugin = result.plugins.find((plugin) => plugin.id === "user-mcp");
123
+ assert.equal(core.enabled, true);
124
+ assert.equal(core.state, "current");
125
+ assert.equal(result.events.some((event) => event.kind === "core_plugin_auto_enabled" && event.plugin_id === "core-mcp"), true);
126
+ assert.equal(userPlugin.enabled, false);
127
+ assert.equal(userPlugin.state, "awaiting_enable");
128
+ }));
129
+
112
130
  test("plugin test marks a private candidate and never creates a public route", () => withTempSupervisor((root) => {
113
131
  const managed = path.join(root, "managed");
114
132
  process.env.CLAUTH_MANAGED_PLUGIN_ROOTS = managed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifeaitools/clauth",
3
- "version": "1.30.12",
3
+ "version": "1.30.13",
4
4
  "description": "Hardware-bound credential vault for the LIFEAI infrastructure stack",
5
5
  "type": "module",
6
6
  "bin": {