@alfe.ai/integrations 0.0.14 → 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 +43 -0
- package/dist/index.js +74 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -247,6 +247,18 @@ interface ConfigSchemaField {
|
|
|
247
247
|
/** Only show this field if a specific integration is installed */
|
|
248
248
|
depends_on_integration?: string;
|
|
249
249
|
}
|
|
250
|
+
interface CommandDeclaration {
|
|
251
|
+
/** Dot-namespaced command name (e.g. "support.diagnostic") */
|
|
252
|
+
name: string;
|
|
253
|
+
/** Relative path to handler file within integration directory */
|
|
254
|
+
handler: string;
|
|
255
|
+
/** Exported function name (default: "handle") */
|
|
256
|
+
method?: string;
|
|
257
|
+
/** Timeout in milliseconds (default: 30000) */
|
|
258
|
+
timeout_ms?: number;
|
|
259
|
+
/** Human-readable description */
|
|
260
|
+
description?: string;
|
|
261
|
+
}
|
|
250
262
|
interface SkillInstall {
|
|
251
263
|
/** Relative path within the integration repo to the skill directory */
|
|
252
264
|
path: string;
|
|
@@ -311,6 +323,7 @@ interface IntegrationManifest {
|
|
|
311
323
|
config_schema: ConfigSchemaField[];
|
|
312
324
|
capabilities: string[];
|
|
313
325
|
hooks: IntegrationHooks;
|
|
326
|
+
commands: CommandDeclaration[];
|
|
314
327
|
/** Git repository URL (HTTPS) — not present in YAML, injected by the publish API */
|
|
315
328
|
repository?: string;
|
|
316
329
|
/**
|
|
@@ -489,6 +502,16 @@ declare class IntegrationManager {
|
|
|
489
502
|
* 5. Remove from state file
|
|
490
503
|
*/
|
|
491
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>;
|
|
492
515
|
/**
|
|
493
516
|
* Run health checks for one or all integrations.
|
|
494
517
|
*/
|
|
@@ -501,6 +524,21 @@ declare class IntegrationManager {
|
|
|
501
524
|
* Get a specific integration by name.
|
|
502
525
|
*/
|
|
503
526
|
get(name: string): IntegrationInfo | undefined;
|
|
527
|
+
/**
|
|
528
|
+
* Get command declarations from all active integrations with resolved absolute paths.
|
|
529
|
+
* Used by the daemon to rebuild the command registry after reconciliation.
|
|
530
|
+
*/
|
|
531
|
+
getActiveCommands(): {
|
|
532
|
+
integrationId: string;
|
|
533
|
+
commands: {
|
|
534
|
+
name: string;
|
|
535
|
+
handler: string;
|
|
536
|
+
resolvedPath: string;
|
|
537
|
+
method: string;
|
|
538
|
+
timeoutMs: number;
|
|
539
|
+
description?: string;
|
|
540
|
+
}[];
|
|
541
|
+
}[];
|
|
504
542
|
/**
|
|
505
543
|
* Clear in-memory secrets (called on daemon restart).
|
|
506
544
|
*/
|
|
@@ -744,6 +782,7 @@ interface IIntegrationManager {
|
|
|
744
782
|
id: string;
|
|
745
783
|
version: string;
|
|
746
784
|
status: string;
|
|
785
|
+
installedAt?: string;
|
|
747
786
|
}[]>;
|
|
748
787
|
/** Install an integration at a specific version with config */
|
|
749
788
|
install(integrationId: string, version: string, config: unknown): Promise<void>;
|
|
@@ -753,6 +792,8 @@ interface IIntegrationManager {
|
|
|
753
792
|
deactivate(integrationId: string): Promise<void>;
|
|
754
793
|
/** Uninstall an integration */
|
|
755
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>;
|
|
756
797
|
}
|
|
757
798
|
declare class IntegrationManagerAdapter implements IIntegrationManager {
|
|
758
799
|
private readonly manager;
|
|
@@ -761,11 +802,13 @@ declare class IntegrationManagerAdapter implements IIntegrationManager {
|
|
|
761
802
|
id: string;
|
|
762
803
|
version: string;
|
|
763
804
|
status: string;
|
|
805
|
+
installedAt?: string;
|
|
764
806
|
}[]>;
|
|
765
807
|
install(integrationId: string, version: string, config: unknown): Promise<void>;
|
|
766
808
|
activate(integrationId: string): Promise<void>;
|
|
767
809
|
deactivate(integrationId: string): Promise<void>;
|
|
768
810
|
uninstall(integrationId: string): Promise<void>;
|
|
811
|
+
reinstall(integrationId: string, version: string, config: unknown): Promise<void>;
|
|
769
812
|
}
|
|
770
813
|
//#endregion
|
|
771
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
|
@@ -137,7 +137,8 @@ const NPM_TIMEOUT_MS = 6e4;
|
|
|
137
137
|
/** Shared @alfe.ai packages available to all integration hooks */
|
|
138
138
|
const SHARED_PACKAGES = {
|
|
139
139
|
"@alfe.ai/config": "latest",
|
|
140
|
-
"@alfe.ai/agent-api-client": "latest"
|
|
140
|
+
"@alfe.ai/agent-api-client": "latest",
|
|
141
|
+
"@alfe.ai/doctor": "latest"
|
|
141
142
|
};
|
|
142
143
|
var InstallerError = class extends Error {
|
|
143
144
|
constructor(message) {
|
|
@@ -1194,6 +1195,37 @@ var IntegrationManager = class {
|
|
|
1194
1195
|
}
|
|
1195
1196
|
}
|
|
1196
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
|
+
/**
|
|
1197
1229
|
* Run health checks for one or all integrations.
|
|
1198
1230
|
*/
|
|
1199
1231
|
async health(params) {
|
|
@@ -1247,6 +1279,37 @@ var IntegrationManager = class {
|
|
|
1247
1279
|
};
|
|
1248
1280
|
}
|
|
1249
1281
|
/**
|
|
1282
|
+
* Get command declarations from all active integrations with resolved absolute paths.
|
|
1283
|
+
* Used by the daemon to rebuild the command registry after reconciliation.
|
|
1284
|
+
*/
|
|
1285
|
+
getActiveCommands() {
|
|
1286
|
+
const result = [];
|
|
1287
|
+
for (const entry of this.state.list()) {
|
|
1288
|
+
if (entry.status !== "active") continue;
|
|
1289
|
+
const installPath = this.installer.getInstallPath(entry.id);
|
|
1290
|
+
const manifestPath = join(installPath, "alfe-integration.yaml");
|
|
1291
|
+
if (!existsSync(manifestPath)) continue;
|
|
1292
|
+
try {
|
|
1293
|
+
const manifest = parseManifestFile(manifestPath);
|
|
1294
|
+
if (manifest.commands.length === 0) continue;
|
|
1295
|
+
result.push({
|
|
1296
|
+
integrationId: entry.id,
|
|
1297
|
+
commands: manifest.commands.map((cmd) => ({
|
|
1298
|
+
name: cmd.name,
|
|
1299
|
+
handler: cmd.handler,
|
|
1300
|
+
resolvedPath: join(installPath, cmd.handler),
|
|
1301
|
+
method: cmd.method ?? "handle",
|
|
1302
|
+
timeoutMs: cmd.timeout_ms ?? 3e4,
|
|
1303
|
+
description: cmd.description
|
|
1304
|
+
}))
|
|
1305
|
+
});
|
|
1306
|
+
} catch (err) {
|
|
1307
|
+
this.log.warn(`Failed to read commands for "${entry.id}": ${err instanceof Error ? err.message : String(err)}`);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
return result;
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1250
1313
|
* Clear in-memory secrets (called on daemon restart).
|
|
1251
1314
|
*/
|
|
1252
1315
|
clear() {
|
|
@@ -1525,7 +1588,8 @@ var IntegrationManagerAdapter = class {
|
|
|
1525
1588
|
return Promise.resolve(integrations.map((i) => ({
|
|
1526
1589
|
id: i.id,
|
|
1527
1590
|
version: i.version ?? "unknown",
|
|
1528
|
-
status: i.status
|
|
1591
|
+
status: i.status,
|
|
1592
|
+
installedAt: i.installedAt
|
|
1529
1593
|
})));
|
|
1530
1594
|
}
|
|
1531
1595
|
async install(integrationId, version, config) {
|
|
@@ -1548,6 +1612,14 @@ var IntegrationManagerAdapter = class {
|
|
|
1548
1612
|
const result = await this.manager.uninstall({ name: integrationId });
|
|
1549
1613
|
if (!result.ok) throw new Error(result.error?.message ?? `Failed to uninstall ${integrationId}`);
|
|
1550
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
|
+
}
|
|
1551
1623
|
};
|
|
1552
1624
|
//#endregion
|
|
1553
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.
|
|
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",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@auriclabs/logger": "^0.1.1",
|
|
16
|
-
"@alfe.ai/integration-manifest": "^0.0.
|
|
16
|
+
"@alfe.ai/integration-manifest": "^0.0.6"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"dist"
|