@alfe.ai/integrations 0.0.15 → 0.0.17

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
@@ -261,7 +261,9 @@ interface CommandDeclaration {
261
261
  }
262
262
  interface SkillInstall {
263
263
  /** Relative path within the integration repo to the skill directory */
264
- path: string;
264
+ path?: string;
265
+ /** ClawHub skill slug to install from the registry */
266
+ clawhub?: string;
265
267
  }
266
268
  interface PluginInstall {
267
269
  /** npm package name to install */
@@ -332,6 +334,12 @@ interface IntegrationManifest {
332
334
  * Example: ['openclaw'] means this integration only works with OpenClaw.
333
335
  */
334
336
  supported_agents?: AgentRuntime[];
337
+ /**
338
+ * Scopes where this integration can be installed.
339
+ * Default: ['agent'] (per-agent only).
340
+ * 'org' means it can be installed at the org level and cascades to all agents.
341
+ */
342
+ supported_scopes?: ('agent' | 'org')[];
335
343
  /** Marketplace metadata */
336
344
  publisherId?: string;
337
345
  icon?: string;
@@ -367,6 +375,8 @@ interface RuntimeApplier {
367
375
  removePlugin(pkg: string): Promise<void>;
368
376
  /** Copy a skill directory into this runtime's skills location */
369
377
  applySkill(name: string, srcPath: string): Promise<void>;
378
+ /** Install a skill from ClawHub registry */
379
+ applyClawHubSkill(slug: string): Promise<void>;
370
380
  /** Remove a skill directory from this runtime */
371
381
  removeSkill(name: string): Promise<void>;
372
382
  /** Deep-merge config into the runtime's agent configuration */
@@ -502,6 +512,16 @@ declare class IntegrationManager {
502
512
  * 5. Remove from state file
503
513
  */
504
514
  uninstall(params: IntegrationRemoveParams): Promise<ManagerResponse>;
515
+ /**
516
+ * Reinstall an integration — full teardown then fresh install + activate.
517
+ *
518
+ * 1. Uninstall (deactivates plugins/skills/config, runs hooks, removes git clone + state)
519
+ * 2. Fresh install (git clone, hooks, state)
520
+ * 3. Activate (apply plugins/skills/config to runtime)
521
+ *
522
+ * If not currently installed, does a normal install + activate.
523
+ */
524
+ reinstall(params: IntegrationInstallParams): Promise<ManagerResponse>;
505
525
  /**
506
526
  * Run health checks for one or all integrations.
507
527
  */
@@ -691,6 +711,7 @@ declare class OpenClawApplier implements RuntimeApplier {
691
711
  private isPluginInstalled;
692
712
  removePlugin(pkg: string): Promise<void>;
693
713
  applySkill(name: string, srcPath: string): Promise<void>;
714
+ applyClawHubSkill(slug: string): Promise<void>;
694
715
  removeSkill(name: string): Promise<void>;
695
716
  /**
696
717
  * Apply integration config to the OpenClaw runtime via `openclaw config set`.
@@ -772,6 +793,7 @@ interface IIntegrationManager {
772
793
  id: string;
773
794
  version: string;
774
795
  status: string;
796
+ installedAt?: string;
775
797
  }[]>;
776
798
  /** Install an integration at a specific version with config */
777
799
  install(integrationId: string, version: string, config: unknown): Promise<void>;
@@ -781,6 +803,8 @@ interface IIntegrationManager {
781
803
  deactivate(integrationId: string): Promise<void>;
782
804
  /** Uninstall an integration */
783
805
  uninstall(integrationId: string): Promise<void>;
806
+ /** Reinstall an integration — full teardown then fresh install + activate */
807
+ reinstall(integrationId: string, version: string, config: unknown): Promise<void>;
784
808
  }
785
809
  declare class IntegrationManagerAdapter implements IIntegrationManager {
786
810
  private readonly manager;
@@ -789,11 +813,13 @@ declare class IntegrationManagerAdapter implements IIntegrationManager {
789
813
  id: string;
790
814
  version: string;
791
815
  status: string;
816
+ installedAt?: string;
792
817
  }[]>;
793
818
  install(integrationId: string, version: string, config: unknown): Promise<void>;
794
819
  activate(integrationId: string): Promise<void>;
795
820
  deactivate(integrationId: string): Promise<void>;
796
821
  uninstall(integrationId: string): Promise<void>;
822
+ reinstall(integrationId: string, version: string, config: unknown): Promise<void>;
797
823
  }
798
824
  //#endregion
799
825
  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
@@ -549,10 +549,11 @@ var LockManager = class {
549
549
  integrationVersion: version
550
550
  });
551
551
  for (const skill of skills) {
552
- const name = skill.path.split("/").pop() ?? skill.path;
552
+ const name = skill.clawhub ?? skill.path?.split("/").pop() ?? "unknown";
553
+ const sourcePath = skill.path ? join(installPath, skill.path) : `clawhub:${skill.clawhub ?? ""}`;
553
554
  if (!state.skills.some((s) => s.name === name && s.sourceIntegration === integrationId)) state.skills.push({
554
555
  name,
555
- sourcePath: join(installPath, skill.path),
556
+ sourcePath,
556
557
  sourceIntegration: integrationId,
557
558
  integrationVersion: version
558
559
  });
@@ -1009,7 +1010,10 @@ var IntegrationManager = class {
1009
1010
  this.log.info(`Applying plugin ${plugin.package} to ${runtimeName}`);
1010
1011
  await applier.applyPlugin(plugin.package, installPath);
1011
1012
  }
1012
- for (const skill of skills) {
1013
+ for (const skill of skills) if (skill.clawhub) {
1014
+ this.log.info(`Installing ClawHub skill ${skill.clawhub} to ${runtimeName}`);
1015
+ await applier.applyClawHubSkill(skill.clawhub);
1016
+ } else if (skill.path) {
1013
1017
  const skillName = skill.path.split("/").pop() ?? skill.path;
1014
1018
  const srcPath = join(installPath, skill.path);
1015
1019
  this.log.info(`Applying skill ${skillName} to ${runtimeName}`);
@@ -1195,6 +1199,37 @@ var IntegrationManager = class {
1195
1199
  }
1196
1200
  }
1197
1201
  /**
1202
+ * Reinstall an integration — full teardown then fresh install + activate.
1203
+ *
1204
+ * 1. Uninstall (deactivates plugins/skills/config, runs hooks, removes git clone + state)
1205
+ * 2. Fresh install (git clone, hooks, state)
1206
+ * 3. Activate (apply plugins/skills/config to runtime)
1207
+ *
1208
+ * If not currently installed, does a normal install + activate.
1209
+ */
1210
+ async reinstall(params) {
1211
+ const { name } = params;
1212
+ if (!name) return this.err("INVALID_PARAMS", "Integration name is required");
1213
+ if (!this.state.get(name)) {
1214
+ const installResult = await this.install(params);
1215
+ if (!installResult.ok) return installResult;
1216
+ return this.activate(name);
1217
+ }
1218
+ this.log.info(`Reinstalling integration: ${name}`);
1219
+ try {
1220
+ const uninstallResult = await this.uninstall({ name });
1221
+ if (!uninstallResult.ok) this.log.warn(`Uninstall returned error during reinstall: ${String(uninstallResult.error?.message)} — proceeding with install`);
1222
+ const installResult = await this.install(params);
1223
+ if (!installResult.ok) return installResult;
1224
+ return await this.activate(name);
1225
+ } catch (err) {
1226
+ const message = err instanceof Error ? err.message : String(err);
1227
+ this.log.error(`Failed to reinstall "${name}": ${message}`);
1228
+ this.state.setStatus(name, "error", message);
1229
+ return this.err("REINSTALL_FAILED", message);
1230
+ }
1231
+ }
1232
+ /**
1198
1233
  * Run health checks for one or all integrations.
1199
1234
  */
1200
1235
  async health(params) {
@@ -1463,6 +1498,19 @@ var OpenClawApplier = class {
1463
1498
  cpSync(srcPath, join(this.skillsDir, name), { recursive: true });
1464
1499
  return Promise.resolve();
1465
1500
  }
1501
+ async applyClawHubSkill(slug) {
1502
+ log.info({ slug }, "Installing skill from ClawHub");
1503
+ try {
1504
+ await execFileAsync("clawhub", ["install", slug], { timeout: 6e4 });
1505
+ log.info({ slug }, "ClawHub skill installed");
1506
+ } catch (err) {
1507
+ const msg = err instanceof Error ? err.message : String(err);
1508
+ log.warn({
1509
+ slug,
1510
+ err: msg
1511
+ }, "ClawHub skill install failed — clawhub CLI may not be available");
1512
+ }
1513
+ }
1466
1514
  removeSkill(name) {
1467
1515
  const skillPath = join(this.skillsDir, name);
1468
1516
  if (existsSync(skillPath)) rmSync(skillPath, {
@@ -1557,7 +1605,8 @@ var IntegrationManagerAdapter = class {
1557
1605
  return Promise.resolve(integrations.map((i) => ({
1558
1606
  id: i.id,
1559
1607
  version: i.version ?? "unknown",
1560
- status: i.status
1608
+ status: i.status,
1609
+ installedAt: i.installedAt
1561
1610
  })));
1562
1611
  }
1563
1612
  async install(integrationId, version, config) {
@@ -1580,6 +1629,14 @@ var IntegrationManagerAdapter = class {
1580
1629
  const result = await this.manager.uninstall({ name: integrationId });
1581
1630
  if (!result.ok) throw new Error(result.error?.message ?? `Failed to uninstall ${integrationId}`);
1582
1631
  }
1632
+ async reinstall(integrationId, version, config) {
1633
+ const result = await this.manager.reinstall({
1634
+ name: integrationId,
1635
+ version,
1636
+ config
1637
+ });
1638
+ if (!result.ok) throw new Error(result.error?.message ?? `Failed to reinstall ${integrationId}`);
1639
+ }
1583
1640
  };
1584
1641
  //#endregion
1585
1642
  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.17",
4
4
  "description": "Integration lifecycle management for Alfe — registry, resolution, installation, and state",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "@auriclabs/logger": "^0.1.1",
16
- "@alfe.ai/integration-manifest": "^0.0.6"
16
+ "@alfe.ai/integration-manifest": "^0.0.7"
17
17
  },
18
18
  "files": [
19
19
  "dist"