@stamn/stamn-plugin 0.1.0-alpha.8 → 0.1.0-alpha.9
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.js +10 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5092,6 +5092,7 @@ import { existsSync as existsSync2, rmSync as rmSync2 } from "fs";
|
|
|
5092
5092
|
import { join as join3 } from "path";
|
|
5093
5093
|
import { homedir } from "os";
|
|
5094
5094
|
var DEFAULT_SERVER_URL = "https://api.stamn.com";
|
|
5095
|
+
var PLUGIN_ID = "stamn-plugin";
|
|
5095
5096
|
function getWsUrl() {
|
|
5096
5097
|
const base = process.env.STAMN_SERVER_URL || DEFAULT_SERVER_URL;
|
|
5097
5098
|
const wsBase = base.replace(/^https:\/\//, "wss://").replace(/^http:\/\//, "ws://");
|
|
@@ -5106,9 +5107,9 @@ function getConfigPath() {
|
|
|
5106
5107
|
function ensurePluginConfig(config) {
|
|
5107
5108
|
if (!config.plugins) config.plugins = {};
|
|
5108
5109
|
if (!config.plugins.entries) config.plugins.entries = {};
|
|
5109
|
-
if (!config.plugins.entries
|
|
5110
|
-
if (!config.plugins.entries.
|
|
5111
|
-
config.plugins.entries.
|
|
5110
|
+
if (!config.plugins.entries[PLUGIN_ID]) config.plugins.entries[PLUGIN_ID] = {};
|
|
5111
|
+
if (!config.plugins.entries[PLUGIN_ID].config)
|
|
5112
|
+
config.plugins.entries[PLUGIN_ID].config = {};
|
|
5112
5113
|
return config;
|
|
5113
5114
|
}
|
|
5114
5115
|
function readOpenclawConfig() {
|
|
@@ -5119,16 +5120,16 @@ function createOpenclawAdapter() {
|
|
|
5119
5120
|
getConfigPath,
|
|
5120
5121
|
readConfig() {
|
|
5121
5122
|
const raw = readOpenclawConfig();
|
|
5122
|
-
const stamnConfig = raw?.plugins?.entries?.
|
|
5123
|
+
const stamnConfig = raw?.plugins?.entries?.[PLUGIN_ID]?.config;
|
|
5123
5124
|
if (!stamnConfig) return null;
|
|
5124
5125
|
return stamnConfig;
|
|
5125
5126
|
},
|
|
5126
5127
|
writeConfig(updates) {
|
|
5127
5128
|
const config = readOpenclawConfig();
|
|
5128
5129
|
ensurePluginConfig(config);
|
|
5129
|
-
config.plugins.entries.
|
|
5130
|
-
config.plugins.entries.
|
|
5131
|
-
...config.plugins.entries.
|
|
5130
|
+
config.plugins.entries[PLUGIN_ID].enabled = true;
|
|
5131
|
+
config.plugins.entries[PLUGIN_ID].config = {
|
|
5132
|
+
...config.plugins.entries[PLUGIN_ID].config,
|
|
5132
5133
|
...updates
|
|
5133
5134
|
};
|
|
5134
5135
|
writeJsonFile(getConfigPath(), config);
|
|
@@ -5138,8 +5139,8 @@ function createOpenclawAdapter() {
|
|
|
5138
5139
|
},
|
|
5139
5140
|
uninstall() {
|
|
5140
5141
|
const config = readOpenclawConfig();
|
|
5141
|
-
if (config?.plugins?.entries?.
|
|
5142
|
-
delete config.plugins.entries
|
|
5142
|
+
if (config?.plugins?.entries?.[PLUGIN_ID]) {
|
|
5143
|
+
delete config.plugins.entries[PLUGIN_ID];
|
|
5143
5144
|
writeJsonFile(getConfigPath(), config);
|
|
5144
5145
|
}
|
|
5145
5146
|
const statusPath = join3(homedir(), ".openclaw", "stamn-status.json");
|