@alfe.ai/integrations 0.0.15 → 0.0.16

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/dist/index.d.ts CHANGED
@@ -502,6 +502,16 @@ declare class IntegrationManager {
502
502
  * 5. Remove from state file
503
503
  */
504
504
  uninstall(params: IntegrationRemoveParams): Promise<ManagerResponse>;
505
+ /**
506
+ * Reinstall an integration — full teardown then fresh install + activate.
507
+ *
508
+ * 1. Uninstall (deactivates plugins/skills/config, runs hooks, removes git clone + state)
509
+ * 2. Fresh install (git clone, hooks, state)
510
+ * 3. Activate (apply plugins/skills/config to runtime)
511
+ *
512
+ * If not currently installed, does a normal install + activate.
513
+ */
514
+ reinstall(params: IntegrationInstallParams): Promise<ManagerResponse>;
505
515
  /**
506
516
  * Run health checks for one or all integrations.
507
517
  */
@@ -772,6 +782,7 @@ interface IIntegrationManager {
772
782
  id: string;
773
783
  version: string;
774
784
  status: string;
785
+ installedAt?: string;
775
786
  }[]>;
776
787
  /** Install an integration at a specific version with config */
777
788
  install(integrationId: string, version: string, config: unknown): Promise<void>;
@@ -781,6 +792,8 @@ interface IIntegrationManager {
781
792
  deactivate(integrationId: string): Promise<void>;
782
793
  /** Uninstall an integration */
783
794
  uninstall(integrationId: string): Promise<void>;
795
+ /** Reinstall an integration — full teardown then fresh install + activate */
796
+ reinstall(integrationId: string, version: string, config: unknown): Promise<void>;
784
797
  }
785
798
  declare class IntegrationManagerAdapter implements IIntegrationManager {
786
799
  private readonly manager;
@@ -789,11 +802,13 @@ declare class IntegrationManagerAdapter implements IIntegrationManager {
789
802
  id: string;
790
803
  version: string;
791
804
  status: string;
805
+ installedAt?: string;
792
806
  }[]>;
793
807
  install(integrationId: string, version: string, config: unknown): Promise<void>;
794
808
  activate(integrationId: string): Promise<void>;
795
809
  deactivate(integrationId: string): Promise<void>;
796
810
  uninstall(integrationId: string): Promise<void>;
811
+ reinstall(integrationId: string, version: string, config: unknown): Promise<void>;
797
812
  }
798
813
  //#endregion
799
814
  export { type HookEnvOptions, type HookResult, type IIntegrationManager, type InstalledInfo, Installer, InstallerError, type IntegrationConfigureParams, type IntegrationHealthParams, type IntegrationInfo, type IntegrationInstallParams, IntegrationManager, IntegrationManagerAdapter, type IntegrationManagerOptions, type IntegrationRemoveParams, LockManager, OpenClawApplier, type OpenClawApplierOptions, Registry, type RegistryEntry, type RegistryFetcher, type RegistryIndex, RegistryResolveError, type ResolvedIntegration, Resolver, type RuntimeApplier, type RuntimeDesiredState, type RuntimeLockFile, type RuntimePluginEntry, type RuntimeSkillEntry, StateManager, buildHookEnv, resolveInstallsForRuntime, runHook, runHookWithContext };
package/dist/index.js CHANGED
@@ -1195,6 +1195,37 @@ var IntegrationManager = class {
1195
1195
  }
1196
1196
  }
1197
1197
  /**
1198
+ * Reinstall an integration — full teardown then fresh install + activate.
1199
+ *
1200
+ * 1. Uninstall (deactivates plugins/skills/config, runs hooks, removes git clone + state)
1201
+ * 2. Fresh install (git clone, hooks, state)
1202
+ * 3. Activate (apply plugins/skills/config to runtime)
1203
+ *
1204
+ * If not currently installed, does a normal install + activate.
1205
+ */
1206
+ async reinstall(params) {
1207
+ const { name } = params;
1208
+ if (!name) return this.err("INVALID_PARAMS", "Integration name is required");
1209
+ if (!this.state.get(name)) {
1210
+ const installResult = await this.install(params);
1211
+ if (!installResult.ok) return installResult;
1212
+ return this.activate(name);
1213
+ }
1214
+ this.log.info(`Reinstalling integration: ${name}`);
1215
+ try {
1216
+ const uninstallResult = await this.uninstall({ name });
1217
+ if (!uninstallResult.ok) this.log.warn(`Uninstall returned error during reinstall: ${String(uninstallResult.error?.message)} — proceeding with install`);
1218
+ const installResult = await this.install(params);
1219
+ if (!installResult.ok) return installResult;
1220
+ return await this.activate(name);
1221
+ } catch (err) {
1222
+ const message = err instanceof Error ? err.message : String(err);
1223
+ this.log.error(`Failed to reinstall "${name}": ${message}`);
1224
+ this.state.setStatus(name, "error", message);
1225
+ return this.err("REINSTALL_FAILED", message);
1226
+ }
1227
+ }
1228
+ /**
1198
1229
  * Run health checks for one or all integrations.
1199
1230
  */
1200
1231
  async health(params) {
@@ -1557,7 +1588,8 @@ var IntegrationManagerAdapter = class {
1557
1588
  return Promise.resolve(integrations.map((i) => ({
1558
1589
  id: i.id,
1559
1590
  version: i.version ?? "unknown",
1560
- status: i.status
1591
+ status: i.status,
1592
+ installedAt: i.installedAt
1561
1593
  })));
1562
1594
  }
1563
1595
  async install(integrationId, version, config) {
@@ -1580,6 +1612,14 @@ var IntegrationManagerAdapter = class {
1580
1612
  const result = await this.manager.uninstall({ name: integrationId });
1581
1613
  if (!result.ok) throw new Error(result.error?.message ?? `Failed to uninstall ${integrationId}`);
1582
1614
  }
1615
+ async reinstall(integrationId, version, config) {
1616
+ const result = await this.manager.reinstall({
1617
+ name: integrationId,
1618
+ version,
1619
+ config
1620
+ });
1621
+ if (!result.ok) throw new Error(result.error?.message ?? `Failed to reinstall ${integrationId}`);
1622
+ }
1583
1623
  };
1584
1624
  //#endregion
1585
1625
  export { Installer, InstallerError, IntegrationManager, IntegrationManagerAdapter, LockManager, OpenClawApplier, Registry, RegistryResolveError, Resolver, StateManager, buildHookEnv, resolveInstallsForRuntime, runHook, runHookWithContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alfe.ai/integrations",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "description": "Integration lifecycle management for Alfe — registry, resolution, installation, and state",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",