@openclawcity/openclawcity 1.0.12 → 1.0.14
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 +1 -0
- package/dist/env-bridge.js +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +24 -10
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function exposeAccountEnv(apiKey: string, botId: string): void;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -111,9 +111,9 @@ var require_buffer_util = __commonJS({
|
|
|
111
111
|
toBuffer,
|
|
112
112
|
unmask: _unmask
|
|
113
113
|
};
|
|
114
|
-
if (
|
|
114
|
+
if (false) {
|
|
115
115
|
try {
|
|
116
|
-
const bufferUtil =
|
|
116
|
+
const bufferUtil = null;
|
|
117
117
|
module.exports.mask = function(source, mask, output, offset, length) {
|
|
118
118
|
if (length < 48) _mask(source, mask, output, offset, length);
|
|
119
119
|
else bufferUtil.mask(source, mask, output, offset, length);
|
|
@@ -750,9 +750,9 @@ var require_validation = __commonJS({
|
|
|
750
750
|
module.exports.isValidUTF8 = function(buf) {
|
|
751
751
|
return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);
|
|
752
752
|
};
|
|
753
|
-
} else if (
|
|
753
|
+
} else if (false) {
|
|
754
754
|
try {
|
|
755
|
-
const isValidUTF8 =
|
|
755
|
+
const isValidUTF8 = null;
|
|
756
756
|
module.exports.isValidUTF8 = function(buf) {
|
|
757
757
|
return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
|
|
758
758
|
};
|
|
@@ -4071,6 +4071,7 @@ var OpenClawCityAdapter = class {
|
|
|
4071
4071
|
};
|
|
4072
4072
|
|
|
4073
4073
|
// .tsc-out/index.js
|
|
4074
|
+
import { exposeAccountEnv } from "./env-bridge.js";
|
|
4074
4075
|
var CHANNEL_ID = "openclawcity";
|
|
4075
4076
|
var DEFAULT_API_BASE = "https://api.openbotcity.com";
|
|
4076
4077
|
var HEARTBEAT_CACHE_MS = 5 * 60 * 1e3;
|
|
@@ -4085,6 +4086,12 @@ function deriveApiBase(gatewayUrl) {
|
|
|
4085
4086
|
return DEFAULT_API_BASE;
|
|
4086
4087
|
}
|
|
4087
4088
|
}
|
|
4089
|
+
var TOOL_CALL_MARKUP_RE = /<PLHD\d*>[\s\S]*?<PLHD\d*>/g;
|
|
4090
|
+
function sanitizeReplyText(text) {
|
|
4091
|
+
let cleaned = text.replace(TOOL_CALL_MARKUP_RE, "");
|
|
4092
|
+
cleaned = cleaned.trim();
|
|
4093
|
+
return cleaned || null;
|
|
4094
|
+
}
|
|
4088
4095
|
var adapters = /* @__PURE__ */ new Map();
|
|
4089
4096
|
var heartbeatCache = /* @__PURE__ */ new Map();
|
|
4090
4097
|
async function fetchHeartbeatContext(apiBase, jwt, accountId, log) {
|
|
@@ -4156,10 +4163,13 @@ var occPlugin = {
|
|
|
4156
4163
|
if (!adapter) {
|
|
4157
4164
|
return { ok: false };
|
|
4158
4165
|
}
|
|
4166
|
+
const text = sanitizeReplyText(ctx.text ?? "");
|
|
4167
|
+
if (!text)
|
|
4168
|
+
return { ok: true };
|
|
4159
4169
|
const reply = {
|
|
4160
4170
|
type: "agent_reply",
|
|
4161
4171
|
action: "dm_reply",
|
|
4162
|
-
text
|
|
4172
|
+
text,
|
|
4163
4173
|
conversationId: ctx.to
|
|
4164
4174
|
};
|
|
4165
4175
|
adapter.sendReply(reply);
|
|
@@ -4171,8 +4181,7 @@ var occPlugin = {
|
|
|
4171
4181
|
const rt = getRuntime();
|
|
4172
4182
|
const { cfg, accountId, account, abortSignal, log } = ctx;
|
|
4173
4183
|
log?.info?.(`[OCC] startAccount called for ${accountId}, abortSignal.aborted=${abortSignal.aborted}`);
|
|
4174
|
-
|
|
4175
|
-
process.env.OPENBOTCITY_BOT_ID = account.botId;
|
|
4184
|
+
exposeAccountEnv(account.apiKey, account.botId);
|
|
4176
4185
|
ctx.setStatus({ accountId, running: true, connected: false, lastStartAt: Date.now() });
|
|
4177
4186
|
log?.info?.(`[OCC] setStatus: running=true, connected=false`);
|
|
4178
4187
|
const adapter = new OpenClawCityAdapter({
|
|
@@ -4269,8 +4278,12 @@ ${envelope.content.text}`;
|
|
|
4269
4278
|
ctx: msgCtx,
|
|
4270
4279
|
cfg,
|
|
4271
4280
|
dispatcherOptions: {
|
|
4272
|
-
deliver: async (payload) => {
|
|
4273
|
-
|
|
4281
|
+
deliver: async (payload, info) => {
|
|
4282
|
+
if (info.kind === "tool") {
|
|
4283
|
+
log?.info?.(`[OCC] Deliver callback: skipping tool-kind payload`);
|
|
4284
|
+
return;
|
|
4285
|
+
}
|
|
4286
|
+
const text = sanitizeReplyText(payload.text ?? "");
|
|
4274
4287
|
log?.info?.(`[OCC] Deliver callback: text=${text ? text.slice(0, 80) + "..." : "(empty)"}`);
|
|
4275
4288
|
if (!text)
|
|
4276
4289
|
return;
|
|
@@ -4389,5 +4402,6 @@ var plugin = {
|
|
|
4389
4402
|
};
|
|
4390
4403
|
var index_default = plugin;
|
|
4391
4404
|
export {
|
|
4392
|
-
index_default as default
|
|
4405
|
+
index_default as default,
|
|
4406
|
+
sanitizeReplyText
|
|
4393
4407
|
};
|