@openclawcity/openclawcity 1.0.14 → 1.0.16

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.
@@ -1 +1,16 @@
1
- export declare function exposeAccountEnv(apiKey: string, botId: string): void;
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;
@@ -1,7 +1,19 @@
1
- function exposeAccountEnv(apiKey, botId) {
2
- process.env.OPENBOTCITY_JWT = apiKey;
3
- process.env.OPENBOTCITY_BOT_ID = botId;
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.d.ts CHANGED
@@ -3,7 +3,11 @@ export declare function sanitizeReplyText(text: string): string | null;
3
3
  declare const plugin: {
4
4
  id: string;
5
5
  name: string;
6
- configSchema: Record<string, unknown>;
6
+ configSchema: {
7
+ type: "object";
8
+ properties: {};
9
+ additionalProperties: boolean;
10
+ };
7
11
  register(api: OpenClawPluginApi): void;
8
12
  };
9
13
  export default plugin;
package/dist/index.js CHANGED
@@ -3646,9 +3646,6 @@ var require_websocket_server = __commonJS({
3646
3646
  }
3647
3647
  });
3648
3648
 
3649
- // .tsc-out/index.js
3650
- import { emptyPluginConfigSchema } from "openclaw/plugin-sdk";
3651
-
3652
3649
  // .tsc-out/runtime.js
3653
3650
  var runtime = null;
3654
3651
  function setRuntime(next) {
@@ -4071,7 +4068,7 @@ var OpenClawCityAdapter = class {
4071
4068
  };
4072
4069
 
4073
4070
  // .tsc-out/index.js
4074
- import { exposeAccountEnv } from "./env-bridge.js";
4071
+ import { exposeAccountEnv, clearAccountEnv } from "./env-bridge.js";
4075
4072
  var CHANNEL_ID = "openclawcity";
4076
4073
  var DEFAULT_API_BASE = "https://api.openbotcity.com";
4077
4074
  var HEARTBEAT_CACHE_MS = 5 * 60 * 1e3;
@@ -4181,7 +4178,8 @@ var occPlugin = {
4181
4178
  const rt = getRuntime();
4182
4179
  const { cfg, accountId, account, abortSignal, log } = ctx;
4183
4180
  log?.info?.(`[OCC] startAccount called for ${accountId}, abortSignal.aborted=${abortSignal.aborted}`);
4184
- exposeAccountEnv(account.apiKey, account.botId);
4181
+ const accountCount = occPlugin.config.listAccountIds(cfg).length || 1;
4182
+ exposeAccountEnv(account.apiKey, account.botId, accountId, accountCount);
4185
4183
  ctx.setStatus({ accountId, running: true, connected: false, lastStartAt: Date.now() });
4186
4184
  log?.info?.(`[OCC] setStatus: running=true, connected=false`);
4187
4185
  const adapter = new OpenClawCityAdapter({
@@ -4371,6 +4369,7 @@ ${envelope.content.text}`;
4371
4369
  log?.info?.(`[OCC] Abort signal received \u2014 shutting down account ${accountId}`);
4372
4370
  adapter.stop();
4373
4371
  adapters.delete(accountId);
4372
+ clearAccountEnv(accountId);
4374
4373
  ctx.setStatus({
4375
4374
  accountId,
4376
4375
  running: false,
@@ -4394,7 +4393,7 @@ ${envelope.content.text}`;
4394
4393
  var plugin = {
4395
4394
  id: CHANNEL_ID,
4396
4395
  name: "OpenClawCity Channel",
4397
- configSchema: emptyPluginConfigSchema(),
4396
+ configSchema: { type: "object", properties: {}, additionalProperties: true },
4398
4397
  register(api) {
4399
4398
  setRuntime(api.runtime);
4400
4399
  api.registerChannel({ plugin: occPlugin });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openclawcity/openclawcity",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "OpenClawCity channel plugin for OpenClaw — live city events for AI agents",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",