@alfe.ai/integrations 0.0.31 → 0.0.33
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 +10 -0
- package/dist/index.js +65 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -796,6 +796,16 @@ declare class OpenClawApplier implements RuntimeApplier {
|
|
|
796
796
|
* plugins under 2026.5+, which made force-mode skip its uninstall step.
|
|
797
797
|
*/
|
|
798
798
|
private isPluginInstalled;
|
|
799
|
+
/**
|
|
800
|
+
* Remove an extensions/ install that has no matching record in
|
|
801
|
+
* plugins/installs.json. OpenClaw 2026.5+ tracks installs via the records
|
|
802
|
+
* file — a leftover dir from 2026.4 is invisible to `openclaw plugins
|
|
803
|
+
* uninstall` (it errors with "not managed by plugins config/install
|
|
804
|
+
* records") and its pre-migration manifest blocks the new effective-plugin-
|
|
805
|
+
* set loader from importing it. Resetting the dir makes the next install
|
|
806
|
+
* write through the npm path with a proper tracking record.
|
|
807
|
+
*/
|
|
808
|
+
private cleanupUntrackedExtensionInstall;
|
|
799
809
|
removePlugin(pkg: string): Promise<void>;
|
|
800
810
|
applySkill(name: string, srcPath: string): Promise<void>;
|
|
801
811
|
applyClawHubSkill(slug: string): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -811,14 +811,28 @@ async function runHookWithContext(integrationPath, hookScript, options) {
|
|
|
811
811
|
* Deep-walk an object and replace `{{config.KEY}}` patterns with values
|
|
812
812
|
* from the per-agent config. Used to compose manifest runtime config
|
|
813
813
|
* with per-agent secrets (e.g., gateway token).
|
|
814
|
+
*
|
|
815
|
+
* Whole-value substitution: when a string is exactly `{{config.KEY}}` with
|
|
816
|
+
* no surrounding text, the raw config value is substituted preserving its
|
|
817
|
+
* type (array, object, boolean, …). For interpolation inside a larger
|
|
818
|
+
* string, only string/number values are substituted; other types fall
|
|
819
|
+
* through to keep the placeholder.
|
|
814
820
|
*/
|
|
821
|
+
const FULL_PLACEHOLDER = /^\{\{config\.([a-zA-Z0-9_]+)\}\}$/;
|
|
815
822
|
function interpolateSelfConfig(obj, config) {
|
|
816
823
|
const result = {};
|
|
817
|
-
for (const [key, value] of Object.entries(obj)) if (typeof value === "string")
|
|
818
|
-
const
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
824
|
+
for (const [key, value] of Object.entries(obj)) if (typeof value === "string") {
|
|
825
|
+
const wholeMatch = FULL_PLACEHOLDER.exec(value);
|
|
826
|
+
if (wholeMatch) {
|
|
827
|
+
const raw = config[wholeMatch[1]];
|
|
828
|
+
result[key] = raw !== void 0 ? raw : value;
|
|
829
|
+
continue;
|
|
830
|
+
}
|
|
831
|
+
result[key] = value.replace(/\{\{config\.([a-zA-Z0-9_]+)\}\}/g, (_match, configKey) => {
|
|
832
|
+
const val = config[configKey];
|
|
833
|
+
return typeof val === "string" || typeof val === "number" ? String(val) : _match;
|
|
834
|
+
});
|
|
835
|
+
} else if (value && typeof value === "object" && !Array.isArray(value)) result[key] = interpolateSelfConfig(value, config);
|
|
822
836
|
else result[key] = value;
|
|
823
837
|
return result;
|
|
824
838
|
}
|
|
@@ -1583,6 +1597,7 @@ var OpenClawApplier = class {
|
|
|
1583
1597
|
}
|
|
1584
1598
|
async applyPlugin(pkg, _installPath, opts) {
|
|
1585
1599
|
await this.ensurePluginsAllow(pkg);
|
|
1600
|
+
this.cleanupUntrackedExtensionInstall(pkg);
|
|
1586
1601
|
if (opts?.force && this.isPluginInstalled(pkg)) {
|
|
1587
1602
|
log.info({ pkg }, "Force mode — uninstalling plugin before reinstall");
|
|
1588
1603
|
try {
|
|
@@ -1674,6 +1689,51 @@ var OpenClawApplier = class {
|
|
|
1674
1689
|
const prefix = pkg.replaceAll("/", "-") + "-";
|
|
1675
1690
|
return readdirSync(extensionsDir).some((dir) => dir.startsWith(prefix) && /^[0-9a-f]+$/i.test(dir.slice(prefix.length)));
|
|
1676
1691
|
}
|
|
1692
|
+
/**
|
|
1693
|
+
* Remove an extensions/ install that has no matching record in
|
|
1694
|
+
* plugins/installs.json. OpenClaw 2026.5+ tracks installs via the records
|
|
1695
|
+
* file — a leftover dir from 2026.4 is invisible to `openclaw plugins
|
|
1696
|
+
* uninstall` (it errors with "not managed by plugins config/install
|
|
1697
|
+
* records") and its pre-migration manifest blocks the new effective-plugin-
|
|
1698
|
+
* set loader from importing it. Resetting the dir makes the next install
|
|
1699
|
+
* write through the npm path with a proper tracking record.
|
|
1700
|
+
*/
|
|
1701
|
+
cleanupUntrackedExtensionInstall(pkg) {
|
|
1702
|
+
const installsPath = join(this.home, "plugins", "installs.json");
|
|
1703
|
+
if (!existsSync(installsPath)) return;
|
|
1704
|
+
let tracked = false;
|
|
1705
|
+
try {
|
|
1706
|
+
const raw = readFileSync(installsPath, "utf8");
|
|
1707
|
+
const data = JSON.parse(raw);
|
|
1708
|
+
tracked = Object.prototype.hasOwnProperty.call(data.installRecords ?? {}, pkg);
|
|
1709
|
+
} catch {
|
|
1710
|
+
return;
|
|
1711
|
+
}
|
|
1712
|
+
if (tracked) return;
|
|
1713
|
+
const extensionsDir = join(this.home, "extensions");
|
|
1714
|
+
if (!existsSync(extensionsDir)) return;
|
|
1715
|
+
const prefix = pkg.replaceAll("/", "-") + "-";
|
|
1716
|
+
const stale = readdirSync(extensionsDir).filter((dir) => dir.startsWith(prefix) && /^[0-9a-f]+$/i.test(dir.slice(prefix.length)));
|
|
1717
|
+
for (const dir of stale) {
|
|
1718
|
+
const fullPath = join(extensionsDir, dir);
|
|
1719
|
+
try {
|
|
1720
|
+
rmSync(fullPath, {
|
|
1721
|
+
recursive: true,
|
|
1722
|
+
force: true
|
|
1723
|
+
});
|
|
1724
|
+
log.info({
|
|
1725
|
+
pkg,
|
|
1726
|
+
removed: fullPath
|
|
1727
|
+
}, "Removed untracked extensions/ install — will reinstall via npm path");
|
|
1728
|
+
} catch (err) {
|
|
1729
|
+
log.warn({
|
|
1730
|
+
pkg,
|
|
1731
|
+
removed: fullPath,
|
|
1732
|
+
err: err instanceof Error ? err.message : String(err)
|
|
1733
|
+
}, "Failed to remove untracked extensions/ install");
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
}
|
|
1677
1737
|
async removePlugin(pkg) {
|
|
1678
1738
|
await execFileAsync("openclaw", [
|
|
1679
1739
|
"plugins",
|
package/package.json
CHANGED