@openclawcity/openclawcity 1.0.14 → 1.0.15
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/env-bridge.d.ts +16 -1
- package/dist/env-bridge.js +15 -3
- package/dist/index.js +4 -2
- package/package.json +1 -1
package/dist/env-bridge.d.ts
CHANGED
|
@@ -1 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Expose account credentials as environment variables for shell commands
|
|
3
|
+
* (SKILL.md templates, tool calls, etc.).
|
|
4
|
+
*
|
|
5
|
+
* Multi-account safety: each account gets scoped vars
|
|
6
|
+
* (OPENBOTCITY_JWT__<accountId>, OPENBOTCITY_BOT_ID__<accountId>).
|
|
7
|
+
* For backward compatibility, unscoped vars are also set when there is
|
|
8
|
+
* exactly one account. When multiple accounts exist, unscoped vars are
|
|
9
|
+
* deleted to prevent silent identity confusion.
|
|
10
|
+
*/
|
|
11
|
+
export declare function exposeAccountEnv(apiKey: string, botId: string, accountId: string, accountCount: number): void;
|
|
12
|
+
/**
|
|
13
|
+
* Remove environment variables for an account that is shutting down.
|
|
14
|
+
* Prevents stale credentials from lingering in the process environment.
|
|
15
|
+
*/
|
|
16
|
+
export declare function clearAccountEnv(accountId: string): void;
|
package/dist/env-bridge.js
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
function exposeAccountEnv(apiKey, botId) {
|
|
2
|
-
process.env
|
|
3
|
-
process.env
|
|
1
|
+
function exposeAccountEnv(apiKey, botId, accountId, accountCount) {
|
|
2
|
+
process.env[`OPENBOTCITY_JWT__${accountId}`] = apiKey;
|
|
3
|
+
process.env[`OPENBOTCITY_BOT_ID__${accountId}`] = botId;
|
|
4
|
+
if (accountCount === 1) {
|
|
5
|
+
process.env.OPENBOTCITY_JWT = apiKey;
|
|
6
|
+
process.env.OPENBOTCITY_BOT_ID = botId;
|
|
7
|
+
} else {
|
|
8
|
+
delete process.env.OPENBOTCITY_JWT;
|
|
9
|
+
delete process.env.OPENBOTCITY_BOT_ID;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function clearAccountEnv(accountId) {
|
|
13
|
+
delete process.env[`OPENBOTCITY_JWT__${accountId}`];
|
|
14
|
+
delete process.env[`OPENBOTCITY_BOT_ID__${accountId}`];
|
|
4
15
|
}
|
|
5
16
|
export {
|
|
17
|
+
clearAccountEnv,
|
|
6
18
|
exposeAccountEnv
|
|
7
19
|
};
|
package/dist/index.js
CHANGED
|
@@ -4071,7 +4071,7 @@ var OpenClawCityAdapter = class {
|
|
|
4071
4071
|
};
|
|
4072
4072
|
|
|
4073
4073
|
// .tsc-out/index.js
|
|
4074
|
-
import { exposeAccountEnv } from "./env-bridge.js";
|
|
4074
|
+
import { exposeAccountEnv, clearAccountEnv } from "./env-bridge.js";
|
|
4075
4075
|
var CHANNEL_ID = "openclawcity";
|
|
4076
4076
|
var DEFAULT_API_BASE = "https://api.openbotcity.com";
|
|
4077
4077
|
var HEARTBEAT_CACHE_MS = 5 * 60 * 1e3;
|
|
@@ -4181,7 +4181,8 @@ var occPlugin = {
|
|
|
4181
4181
|
const rt = getRuntime();
|
|
4182
4182
|
const { cfg, accountId, account, abortSignal, log } = ctx;
|
|
4183
4183
|
log?.info?.(`[OCC] startAccount called for ${accountId}, abortSignal.aborted=${abortSignal.aborted}`);
|
|
4184
|
-
|
|
4184
|
+
const accountCount = occPlugin.config.listAccountIds(cfg).length || 1;
|
|
4185
|
+
exposeAccountEnv(account.apiKey, account.botId, accountId, accountCount);
|
|
4185
4186
|
ctx.setStatus({ accountId, running: true, connected: false, lastStartAt: Date.now() });
|
|
4186
4187
|
log?.info?.(`[OCC] setStatus: running=true, connected=false`);
|
|
4187
4188
|
const adapter = new OpenClawCityAdapter({
|
|
@@ -4371,6 +4372,7 @@ ${envelope.content.text}`;
|
|
|
4371
4372
|
log?.info?.(`[OCC] Abort signal received \u2014 shutting down account ${accountId}`);
|
|
4372
4373
|
adapter.stop();
|
|
4373
4374
|
adapters.delete(accountId);
|
|
4375
|
+
clearAccountEnv(accountId);
|
|
4374
4376
|
ctx.setStatus({
|
|
4375
4377
|
accountId,
|
|
4376
4378
|
running: false,
|