@alfe.ai/integrations 0.6.1 → 0.6.2

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 (2) hide show
  1. package/dist/index.js +28 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2026,13 +2026,40 @@ var IntegrationManager = class {
2026
2026
  async reinstall(params) {
2027
2027
  const { name } = params;
2028
2028
  if (!name) return this.err("INVALID_PARAMS", "Integration name is required");
2029
- if (!this.state.get(name)) {
2029
+ const entry = this.state.get(name);
2030
+ if (!entry) {
2030
2031
  const installResult = await this.install(params);
2031
2032
  if (!installResult.ok) return installResult;
2032
2033
  return this.activate(name);
2033
2034
  }
2034
2035
  this.log.info(`Reinstalling integration: ${name}`);
2035
2036
  try {
2037
+ let effectiveVersion = params.version;
2038
+ if (!effectiveVersion && params.customSource === void 0) try {
2039
+ effectiveVersion = (await this.resolver.resolve(name, void 0, { fresh: true })).version;
2040
+ } catch {
2041
+ effectiveVersion = void 0;
2042
+ }
2043
+ if (effectiveVersion !== void 0 && effectiveVersion === entry.version && params.customSource === void 0) {
2044
+ const localManifestPath = join(this.installer.getInstallPath(name), "alfe-integration.yaml");
2045
+ if (existsSync(localManifestPath)) {
2046
+ let localManifest = null;
2047
+ try {
2048
+ localManifest = parseManifestFile(localManifestPath);
2049
+ } catch {
2050
+ localManifest = null;
2051
+ }
2052
+ if (localManifest) try {
2053
+ validateAndSplitConfig(localManifest, params.config ?? {}, { allowEmpty: true });
2054
+ } catch (err) {
2055
+ if (err instanceof IntegrationConfigValidationError) {
2056
+ this.log.error(`Refusing to reinstall "${name}" — config is invalid and the reinstall would fail after teardown: ${err.message}`);
2057
+ return this.err(err.code, err.message);
2058
+ }
2059
+ throw err;
2060
+ }
2061
+ }
2062
+ }
2036
2063
  const uninstallResult = await this.uninstall({ name });
2037
2064
  if (!uninstallResult.ok) return this.err("REINSTALL_FAILED", `Could not safely remove the existing integration: ${uninstallResult.error?.message ?? "unknown cleanup failure"}`);
2038
2065
  const installResult = await this.install(params);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/integrations",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "description": "Integration lifecycle management for Alfe — registry, resolution, installation, and state",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",