@kanvas/openclaw-plugin 0.1.12 → 0.1.13
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 +19 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -79,20 +79,31 @@ export default {
|
|
|
79
79
|
description: "Connects agents to Kanvas — your company's nervous system for CRM, inventory, orders, and messaging.",
|
|
80
80
|
configSchema: { type: "object" },
|
|
81
81
|
register(api) {
|
|
82
|
-
// Resolve config
|
|
83
|
-
|
|
82
|
+
// Resolve plugin config. api.pluginConfig is set on the gateway init
|
|
83
|
+
// context but often undefined on agent contexts (Slack, subagents, cron).
|
|
84
|
+
// Fall back to extracting from the full app config (api.config), which
|
|
85
|
+
// is always available — matching the pattern used by budget-guard and
|
|
86
|
+
// lossless-claw.
|
|
87
|
+
const pluginCfg = api.pluginConfig
|
|
88
|
+
?? api.config?.plugins?.entries?.kanvas?.config
|
|
89
|
+
?? {};
|
|
90
|
+
let config = null;
|
|
84
91
|
try {
|
|
85
|
-
config = resolveConfig(
|
|
92
|
+
config = resolveConfig(pluginCfg);
|
|
86
93
|
}
|
|
87
94
|
catch (err) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
95
|
+
// If shared state exists from a prior init, fall through to register
|
|
96
|
+
// tools. Otherwise this is genuinely unconfigured — bail.
|
|
97
|
+
if (!sharedClient) {
|
|
98
|
+
if (!skipBannerShown) {
|
|
99
|
+
api.logger.info(`Kanvas plugin skipped: ${err.message}. Run "openclaw kanvas setup" to configure.`);
|
|
100
|
+
skipBannerShown = true;
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
91
103
|
}
|
|
92
|
-
return;
|
|
93
104
|
}
|
|
94
105
|
// Create heavy objects once; reuse across agent contexts.
|
|
95
|
-
if (!sharedClient) {
|
|
106
|
+
if (!sharedClient && config) {
|
|
96
107
|
sharedConfig = config;
|
|
97
108
|
sharedClient = new KanvasClient(config);
|
|
98
109
|
sharedEnsureAuth = createAuthGuard(sharedClient, config, api.logger);
|
package/package.json
CHANGED