@alfe.ai/integrations 0.0.2 → 0.0.3
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 +15 -6
- package/dist/index.js +17 -27
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -58,14 +58,21 @@ interface RegistryIndex {
|
|
|
58
58
|
version: number;
|
|
59
59
|
integrations: Record<string, RegistryEntry>;
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Fetcher function that returns the raw integrations array from the registry API.
|
|
63
|
+
* Callers wire this up using their api-client instance so Registry stays dependency-free.
|
|
64
|
+
*/
|
|
65
|
+
type RegistryFetcher = () => Promise<(RegistryEntry & {
|
|
66
|
+
id: string;
|
|
67
|
+
})[]>;
|
|
61
68
|
declare class Registry {
|
|
62
69
|
private index;
|
|
63
|
-
private
|
|
70
|
+
private fetcher;
|
|
64
71
|
/**
|
|
65
|
-
* @param
|
|
66
|
-
*
|
|
72
|
+
* @param fetcher - Function that fetches the integrations array from the registry API.
|
|
73
|
+
* Typically backed by api-client's IntegrationsService.getRegistry().
|
|
67
74
|
*/
|
|
68
|
-
constructor(
|
|
75
|
+
constructor(fetcher: RegistryFetcher);
|
|
69
76
|
/**
|
|
70
77
|
* Load the registry index. Uses cache if already loaded.
|
|
71
78
|
*/
|
|
@@ -364,6 +371,8 @@ interface IntegrationManagerOptions {
|
|
|
364
371
|
runtimeAppliers?: Map<string, RuntimeApplier>;
|
|
365
372
|
/** Override lock file path (defaults to ~/.alfe/runtime-lock.json) */
|
|
366
373
|
lockPath?: string;
|
|
374
|
+
/** Fetcher for the integration registry — should be wired to api-client */
|
|
375
|
+
registryFetcher: RegistryFetcher;
|
|
367
376
|
}
|
|
368
377
|
interface ManagerResponse {
|
|
369
378
|
ok: boolean;
|
|
@@ -400,7 +409,7 @@ declare class IntegrationManager {
|
|
|
400
409
|
private lockManager;
|
|
401
410
|
/** In-memory secret store — NEVER persisted to disk */
|
|
402
411
|
private secrets;
|
|
403
|
-
constructor(options
|
|
412
|
+
constructor(options: IntegrationManagerOptions);
|
|
404
413
|
/**
|
|
405
414
|
* Install an integration from the registry.
|
|
406
415
|
*
|
|
@@ -714,4 +723,4 @@ declare class IntegrationManagerAdapter implements IIntegrationManager {
|
|
|
714
723
|
uninstall(integrationId: string): Promise<void>;
|
|
715
724
|
}
|
|
716
725
|
//#endregion
|
|
717
|
-
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 RegistryIndex, RegistryResolveError, type ResolvedIntegration, Resolver, type RuntimeApplier, type RuntimeDesiredState, type RuntimeLockFile, type RuntimePluginEntry, type RuntimeSkillEntry, StateManager, buildHookEnv, resolveInstallsForRuntime, runHook, runHookWithContext };
|
|
726
|
+
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
|
@@ -6,37 +6,27 @@ import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, write
|
|
|
6
6
|
import { buildConfigValidationSchema, parseManifestFile } from "@alfe.ai/integration-manifest";
|
|
7
7
|
import { createLogger } from "@auriclabs/logger";
|
|
8
8
|
//#region src/registry.ts
|
|
9
|
-
const DEFAULT_API_URL = "https://api.alfe.ai";
|
|
10
|
-
const REGISTRY_PATH = "/integrations/registry";
|
|
11
9
|
var Registry = class {
|
|
12
10
|
index = null;
|
|
13
|
-
|
|
11
|
+
fetcher;
|
|
14
12
|
/**
|
|
15
|
-
* @param
|
|
16
|
-
*
|
|
13
|
+
* @param fetcher - Function that fetches the integrations array from the registry API.
|
|
14
|
+
* Typically backed by api-client's IntegrationsService.getRegistry().
|
|
17
15
|
*/
|
|
18
|
-
constructor(
|
|
19
|
-
this.
|
|
16
|
+
constructor(fetcher) {
|
|
17
|
+
this.fetcher = fetcher;
|
|
20
18
|
}
|
|
21
19
|
/**
|
|
22
20
|
* Load the registry index. Uses cache if already loaded.
|
|
23
21
|
*/
|
|
24
22
|
async load() {
|
|
25
23
|
if (this.index) return this.index;
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
let integrations;
|
|
33
|
-
if (Array.isArray(raw)) {
|
|
34
|
-
integrations = {};
|
|
35
|
-
for (const entry of raw) {
|
|
36
|
-
const { id, ...rest } = entry;
|
|
37
|
-
integrations[id] = rest;
|
|
38
|
-
}
|
|
39
|
-
} else integrations = raw;
|
|
24
|
+
const raw = await this.fetcher();
|
|
25
|
+
const integrations = {};
|
|
26
|
+
for (const entry of raw) {
|
|
27
|
+
const { id, ...rest } = entry;
|
|
28
|
+
integrations[id] = rest;
|
|
29
|
+
}
|
|
40
30
|
this.index = {
|
|
41
31
|
version: 1,
|
|
42
32
|
integrations
|
|
@@ -98,7 +88,7 @@ var Resolver = class {
|
|
|
98
88
|
async resolve(id, version) {
|
|
99
89
|
const entry = await this.registry.get(id);
|
|
100
90
|
if (!entry) throw new RegistryResolveError(`Integration "${id}" not found in registry`);
|
|
101
|
-
const resolvedVersion = version
|
|
91
|
+
const resolvedVersion = version && version.length > 0 ? version : entry.latest;
|
|
102
92
|
if (!entry.versions.includes(resolvedVersion)) throw new RegistryResolveError(`Version "${resolvedVersion}" not found for integration "${id}". Available versions: ${entry.versions.join(", ")}`);
|
|
103
93
|
return {
|
|
104
94
|
id,
|
|
@@ -686,12 +676,12 @@ var IntegrationManager = class {
|
|
|
686
676
|
/** In-memory secret store — NEVER persisted to disk */
|
|
687
677
|
secrets = /* @__PURE__ */ new Map();
|
|
688
678
|
constructor(options) {
|
|
689
|
-
this.state = new StateManager(options
|
|
690
|
-
this.registry = new Registry();
|
|
679
|
+
this.state = new StateManager(options.statePath);
|
|
680
|
+
this.registry = new Registry(options.registryFetcher);
|
|
691
681
|
this.resolver = new Resolver(this.registry);
|
|
692
|
-
this.installer = new Installer(options
|
|
693
|
-
this.runtimeAppliers = options
|
|
694
|
-
this.lockManager = new LockManager(options
|
|
682
|
+
this.installer = new Installer(options.integrationsDir);
|
|
683
|
+
this.runtimeAppliers = options.runtimeAppliers ?? /* @__PURE__ */ new Map();
|
|
684
|
+
this.lockManager = new LockManager(options.lockPath);
|
|
695
685
|
}
|
|
696
686
|
/**
|
|
697
687
|
* Install an integration from the registry.
|
package/package.json
CHANGED