@inline-openclaw/inline 0.0.36 → 0.0.38
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/README.md +1 -1
- package/dist/approval-handler.runtime.js +8 -2
- package/dist/approval-handler.runtime.js.map +3 -3
- package/dist/channel-plugin-api.js +325 -20
- package/dist/channel-plugin-api.js.map +7 -5
- package/dist/inline/bot-commands-sync.d.ts +9 -0
- package/dist/inline/bot-commands-sync.d.ts.map +1 -1
- package/dist/inline/monitor.d.ts.map +1 -1
- package/dist/runtime-register-api.js +36 -14
- package/dist/runtime-register-api.js.map +4 -4
- package/package.json +1 -1
|
@@ -11324,7 +11324,8 @@ class UpdateDialogOrderInput$Type extends import_runtime4.MessageType {
|
|
|
11324
11324
|
super("UpdateDialogOrderInput", [
|
|
11325
11325
|
{ no: 1, name: "peer_id", kind: "message", T: () => InputPeer },
|
|
11326
11326
|
{ no: 2, name: "order", kind: "scalar", opt: true, T: 9 },
|
|
11327
|
-
{ no: 3, name: "pinned_order", kind: "scalar", opt: true, T: 9 }
|
|
11327
|
+
{ no: 3, name: "pinned_order", kind: "scalar", opt: true, T: 9 },
|
|
11328
|
+
{ no: 4, name: "pinned", kind: "scalar", opt: true, T: 8 }
|
|
11328
11329
|
]);
|
|
11329
11330
|
}
|
|
11330
11331
|
create(value) {
|
|
@@ -11347,6 +11348,9 @@ class UpdateDialogOrderInput$Type extends import_runtime4.MessageType {
|
|
|
11347
11348
|
case 3:
|
|
11348
11349
|
message.pinnedOrder = reader.string();
|
|
11349
11350
|
break;
|
|
11351
|
+
case 4:
|
|
11352
|
+
message.pinned = reader.bool();
|
|
11353
|
+
break;
|
|
11350
11354
|
default:
|
|
11351
11355
|
let u = options.readUnknownField;
|
|
11352
11356
|
if (u === "throw")
|
|
@@ -11365,6 +11369,8 @@ class UpdateDialogOrderInput$Type extends import_runtime4.MessageType {
|
|
|
11365
11369
|
writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.order);
|
|
11366
11370
|
if (message.pinnedOrder !== undefined)
|
|
11367
11371
|
writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.pinnedOrder);
|
|
11372
|
+
if (message.pinned !== undefined)
|
|
11373
|
+
writer.tag(4, import_runtime.WireType.Varint).bool(message.pinned);
|
|
11368
11374
|
let u = options.writeUnknownFields;
|
|
11369
11375
|
if (u !== false)
|
|
11370
11376
|
(u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
@@ -35756,6 +35762,7 @@ import {
|
|
|
35756
35762
|
buildCommandTextFromArgs,
|
|
35757
35763
|
findCommandByNativeName,
|
|
35758
35764
|
formatCommandArgMenuTitle,
|
|
35765
|
+
listNativeCommandSpecsForConfig as listNativeCommandSpecsForConfig2,
|
|
35759
35766
|
parseCommandArgs,
|
|
35760
35767
|
resolveCommandArgMenu
|
|
35761
35768
|
} from "openclaw/plugin-sdk/native-command-registry";
|
|
@@ -35789,7 +35796,8 @@ import {
|
|
|
35789
35796
|
updateSessionStore
|
|
35790
35797
|
} from "openclaw/plugin-sdk/config-runtime";
|
|
35791
35798
|
import { buildModelsProviderData } from "openclaw/plugin-sdk/models-provider-runtime";
|
|
35792
|
-
import { listSkillCommandsForAgents } from "openclaw/plugin-sdk/skill-commands-runtime";
|
|
35799
|
+
import { listSkillCommandsForAgents as listSkillCommandsForAgents2 } from "openclaw/plugin-sdk/skill-commands-runtime";
|
|
35800
|
+
import { getPluginCommandSpecs as getPluginCommandSpecs2 } from "openclaw/plugin-sdk/plugin-runtime";
|
|
35793
35801
|
import { isReasoningReplyPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
35794
35802
|
import {
|
|
35795
35803
|
findCodeRegions,
|
|
@@ -39063,9 +39071,231 @@ function buildInlineModelBrowseChannelData() {
|
|
|
39063
39071
|
return inlineChannelData([[{ text: "Browse providers", callback_data: "mdl_prov" }]]);
|
|
39064
39072
|
}
|
|
39065
39073
|
|
|
39074
|
+
// src/inline/bot-commands-sync.ts
|
|
39075
|
+
import { listNativeCommandSpecsForConfig } from "openclaw/plugin-sdk/native-command-registry";
|
|
39076
|
+
import { getPluginCommandSpecs } from "openclaw/plugin-sdk/plugin-runtime";
|
|
39077
|
+
import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
39078
|
+
import { listSkillCommandsForAgents } from "openclaw/plugin-sdk/skill-commands-runtime";
|
|
39079
|
+
|
|
39080
|
+
// src/inline/bot-commands-api.ts
|
|
39081
|
+
function normalizeInlineBotBaseUrl(baseUrl) {
|
|
39082
|
+
return baseUrl.replace(/\/+$/, "");
|
|
39083
|
+
}
|
|
39084
|
+
function normalizeInlineBotCommandName(raw) {
|
|
39085
|
+
return raw.trim().replace(/^\/+/, "");
|
|
39086
|
+
}
|
|
39087
|
+
async function callInlineBotApi(params) {
|
|
39088
|
+
const baseUrl = normalizeInlineBotBaseUrl(params.baseUrl);
|
|
39089
|
+
const invoke = async (authMode) => {
|
|
39090
|
+
const url2 = authMode === "header" ? `${baseUrl}/bot/${params.methodName}` : `${baseUrl}/bot${encodeURIComponent(params.token)}/${params.methodName}`;
|
|
39091
|
+
const request = {
|
|
39092
|
+
method: params.method,
|
|
39093
|
+
headers: {
|
|
39094
|
+
...authMode === "header" ? { authorization: `Bearer ${params.token}` } : {},
|
|
39095
|
+
...params.body !== undefined ? { "content-type": "application/json" } : {}
|
|
39096
|
+
}
|
|
39097
|
+
};
|
|
39098
|
+
if (params.body !== undefined) {
|
|
39099
|
+
request.body = JSON.stringify(params.body);
|
|
39100
|
+
}
|
|
39101
|
+
let response;
|
|
39102
|
+
try {
|
|
39103
|
+
response = await fetch(url2, request);
|
|
39104
|
+
} catch (error51) {
|
|
39105
|
+
throw new Error(`inline_bot_commands: ${params.method} ${redactInlineBotApiUrl(url2)} fetch failed: ${summarizeInlineBotApiError(error51)}`);
|
|
39106
|
+
}
|
|
39107
|
+
const payload = await response.json().catch(() => null);
|
|
39108
|
+
return { response, payload };
|
|
39109
|
+
};
|
|
39110
|
+
const resolve = (result) => {
|
|
39111
|
+
if (!result.response.ok) {
|
|
39112
|
+
const message = result.payload?.description ?? `HTTP ${result.response.status}`;
|
|
39113
|
+
throw new Error(`inline_bot_commands: ${message}`);
|
|
39114
|
+
}
|
|
39115
|
+
if (!result.payload || result.payload.ok !== true) {
|
|
39116
|
+
const message = result.payload?.description ?? "bot api call failed";
|
|
39117
|
+
throw new Error(`inline_bot_commands: ${message}`);
|
|
39118
|
+
}
|
|
39119
|
+
return result.payload.result ?? {};
|
|
39120
|
+
};
|
|
39121
|
+
const shouldRetryWithPathToken = (result) => {
|
|
39122
|
+
if (result.response.status === 401)
|
|
39123
|
+
return true;
|
|
39124
|
+
if (result.payload?.error_code === 401)
|
|
39125
|
+
return true;
|
|
39126
|
+
const description = result.payload?.description?.toLowerCase() ?? "";
|
|
39127
|
+
return description.includes("unauthorized");
|
|
39128
|
+
};
|
|
39129
|
+
const headerResult = await invoke("header");
|
|
39130
|
+
if (shouldRetryWithPathToken(headerResult)) {
|
|
39131
|
+
const pathResult = await invoke("path");
|
|
39132
|
+
return resolve(pathResult);
|
|
39133
|
+
}
|
|
39134
|
+
return resolve(headerResult);
|
|
39135
|
+
}
|
|
39136
|
+
function summarizeInlineBotApiError(error51) {
|
|
39137
|
+
if (error51 instanceof Error) {
|
|
39138
|
+
return `${error51.name}: ${error51.message}`;
|
|
39139
|
+
}
|
|
39140
|
+
return String(error51);
|
|
39141
|
+
}
|
|
39142
|
+
function redactInlineBotApiUrl(raw) {
|
|
39143
|
+
try {
|
|
39144
|
+
const url2 = new URL(raw);
|
|
39145
|
+
return `${url2.protocol}//${url2.host}${url2.pathname.replace(/\/bot[^/]*\//, "/bot<redacted>/")}`;
|
|
39146
|
+
} catch {
|
|
39147
|
+
return raw.replace(/\/bot[^/]*\//, "/bot<redacted>/");
|
|
39148
|
+
}
|
|
39149
|
+
}
|
|
39150
|
+
|
|
39151
|
+
// src/inline/bot-commands-sync.ts
|
|
39152
|
+
var INLINE_COMMAND_NAME_RE = /^[a-z0-9_]{1,32}$/;
|
|
39153
|
+
var INLINE_COMMAND_LIMIT = 100;
|
|
39154
|
+
var INLINE_COMMAND_DESCRIPTION_LIMIT = 256;
|
|
39155
|
+
var INLINE_NATIVE_COMMAND_PROVIDER = "inline";
|
|
39156
|
+
function normalizeDynamicCommandName(raw) {
|
|
39157
|
+
const trimmed = raw.trim().toLowerCase();
|
|
39158
|
+
const withoutSlash = trimmed.startsWith("/") ? trimmed.slice(1) : trimmed;
|
|
39159
|
+
return withoutSlash.trim();
|
|
39160
|
+
}
|
|
39161
|
+
function appendUniqueCommand(out, seen, command, description, logger) {
|
|
39162
|
+
const normalized = normalizeDynamicCommandName(command);
|
|
39163
|
+
if (!INLINE_COMMAND_NAME_RE.test(normalized) || seen.has(normalized))
|
|
39164
|
+
return;
|
|
39165
|
+
const rawDescription = adaptInlineVisibleCopy(description).trim();
|
|
39166
|
+
const trimmedDescription = rawDescription.length > INLINE_COMMAND_DESCRIPTION_LIMIT ? rawDescription.slice(0, INLINE_COMMAND_DESCRIPTION_LIMIT).trimEnd() : rawDescription;
|
|
39167
|
+
if (!trimmedDescription)
|
|
39168
|
+
return;
|
|
39169
|
+
if (trimmedDescription.length !== rawDescription.length) {
|
|
39170
|
+
logger?.warn?.(`[inline] bot command sync truncated description for /${normalized} to ${INLINE_COMMAND_DESCRIPTION_LIMIT} characters`);
|
|
39171
|
+
}
|
|
39172
|
+
seen.add(normalized);
|
|
39173
|
+
out.push({ command: normalized, description: trimmedDescription });
|
|
39174
|
+
}
|
|
39175
|
+
function shouldSyncInlineNativeCommandsForAccount(params) {
|
|
39176
|
+
const effective = params.account.config.commands?.native ?? params.cfg.commands?.native ?? "auto";
|
|
39177
|
+
return effective !== false;
|
|
39178
|
+
}
|
|
39179
|
+
function shouldSyncInlineNativeSkillsForAccount(params) {
|
|
39180
|
+
const effective = params.account.config.commands?.nativeSkills ?? params.cfg.commands?.nativeSkills ?? "auto";
|
|
39181
|
+
return effective !== false;
|
|
39182
|
+
}
|
|
39183
|
+
async function buildInlineNativeCommandsForConfig(params) {
|
|
39184
|
+
const route = shouldSyncInlineNativeSkillsForAccount({ cfg: params.cfg, account: params.account }) ? resolveAgentRoute({
|
|
39185
|
+
cfg: params.cfg,
|
|
39186
|
+
channel: INLINE_NATIVE_COMMAND_PROVIDER,
|
|
39187
|
+
accountId: params.account.accountId
|
|
39188
|
+
}) : null;
|
|
39189
|
+
const skillCommands = route ? listSkillCommandsForAgents({
|
|
39190
|
+
cfg: params.cfg,
|
|
39191
|
+
agentIds: [route.agentId]
|
|
39192
|
+
}) : [];
|
|
39193
|
+
const nativeSpecs = listNativeCommandSpecsForConfig(params.cfg, {
|
|
39194
|
+
skillCommands,
|
|
39195
|
+
provider: INLINE_NATIVE_COMMAND_PROVIDER
|
|
39196
|
+
});
|
|
39197
|
+
const pluginSpecs = getPluginCommandSpecs("inline", { config: params.cfg });
|
|
39198
|
+
const seen = new Set;
|
|
39199
|
+
const resolved = [];
|
|
39200
|
+
for (const spec of nativeSpecs) {
|
|
39201
|
+
appendUniqueCommand(resolved, seen, spec.name, spec.description, params.logger);
|
|
39202
|
+
}
|
|
39203
|
+
for (const spec of pluginSpecs) {
|
|
39204
|
+
appendUniqueCommand(resolved, seen, spec.name, spec.description, params.logger);
|
|
39205
|
+
}
|
|
39206
|
+
return resolved;
|
|
39207
|
+
}
|
|
39208
|
+
async function syncInlineNativeCommands(params) {
|
|
39209
|
+
const accountIds = listInlineAccountIds(params.cfg);
|
|
39210
|
+
if (!accountIds.length) {
|
|
39211
|
+
params.logger?.info?.("[inline] bot command sync disabled");
|
|
39212
|
+
return { attempted: 0, synced: 0, failed: 0 };
|
|
39213
|
+
}
|
|
39214
|
+
let attempted = 0;
|
|
39215
|
+
let synced = 0;
|
|
39216
|
+
let failed = 0;
|
|
39217
|
+
for (const accountId of accountIds) {
|
|
39218
|
+
const account = resolveInlineAccount({ cfg: params.cfg, accountId });
|
|
39219
|
+
const nativeEnabled = shouldSyncInlineNativeCommandsForAccount({ cfg: params.cfg, account });
|
|
39220
|
+
attempted += 1;
|
|
39221
|
+
if (!account.enabled || !account.configured || !account.baseUrl) {
|
|
39222
|
+
continue;
|
|
39223
|
+
}
|
|
39224
|
+
const ownerAccountId = findInlineTokenOwnerAccountId({
|
|
39225
|
+
cfg: params.cfg,
|
|
39226
|
+
accountId: account.accountId
|
|
39227
|
+
});
|
|
39228
|
+
if (ownerAccountId) {
|
|
39229
|
+
failed += 1;
|
|
39230
|
+
params.logger?.warn?.(`[inline] bot command sync skipped for account "${account.accountId}": ${formatDuplicateInlineTokenReason({
|
|
39231
|
+
accountId: account.accountId,
|
|
39232
|
+
ownerAccountId
|
|
39233
|
+
})}`);
|
|
39234
|
+
continue;
|
|
39235
|
+
}
|
|
39236
|
+
let token;
|
|
39237
|
+
try {
|
|
39238
|
+
token = await resolveInlineToken(account);
|
|
39239
|
+
} catch (err) {
|
|
39240
|
+
failed += 1;
|
|
39241
|
+
params.logger?.warn?.(`[inline] bot command sync skipped for account "${account.accountId}": ${String(err)}`);
|
|
39242
|
+
continue;
|
|
39243
|
+
}
|
|
39244
|
+
if (!nativeEnabled) {
|
|
39245
|
+
try {
|
|
39246
|
+
await callInlineBotApi({
|
|
39247
|
+
baseUrl: account.baseUrl,
|
|
39248
|
+
token,
|
|
39249
|
+
methodName: "deleteMyCommands",
|
|
39250
|
+
method: "POST"
|
|
39251
|
+
});
|
|
39252
|
+
synced += 1;
|
|
39253
|
+
params.logger?.info?.(`[inline] bot commands cleared for account "${account.accountId}"`);
|
|
39254
|
+
} catch (err) {
|
|
39255
|
+
failed += 1;
|
|
39256
|
+
params.logger?.warn?.(`[inline] bot command clear failed for account "${account.accountId}": ${String(err)}`);
|
|
39257
|
+
}
|
|
39258
|
+
continue;
|
|
39259
|
+
}
|
|
39260
|
+
const allCommands = await buildInlineNativeCommandsForConfig({
|
|
39261
|
+
cfg: params.cfg,
|
|
39262
|
+
account,
|
|
39263
|
+
...params.logger ? { logger: params.logger } : {}
|
|
39264
|
+
});
|
|
39265
|
+
const commands = allCommands.slice(0, INLINE_COMMAND_LIMIT);
|
|
39266
|
+
if (allCommands.length > INLINE_COMMAND_LIMIT) {
|
|
39267
|
+
params.logger?.warn?.(`[inline] bot command sync truncating ${allCommands.length} commands to ${INLINE_COMMAND_LIMIT}`);
|
|
39268
|
+
}
|
|
39269
|
+
if (commands.length === 0) {
|
|
39270
|
+
params.logger?.warn?.(`[inline] bot command sync skipped for account "${account.accountId}": no valid commands resolved`);
|
|
39271
|
+
continue;
|
|
39272
|
+
}
|
|
39273
|
+
try {
|
|
39274
|
+
await callInlineBotApi({
|
|
39275
|
+
baseUrl: account.baseUrl,
|
|
39276
|
+
token,
|
|
39277
|
+
methodName: "setMyCommands",
|
|
39278
|
+
method: "POST",
|
|
39279
|
+
body: { commands }
|
|
39280
|
+
});
|
|
39281
|
+
synced += 1;
|
|
39282
|
+
params.logger?.info?.(`[inline] bot commands synced for account "${account.accountId}" (${commands.length} command${commands.length === 1 ? "" : "s"})`);
|
|
39283
|
+
} catch (err) {
|
|
39284
|
+
failed += 1;
|
|
39285
|
+
params.logger?.warn?.(`[inline] bot command sync failed for account "${account.accountId}": ${String(err)}`);
|
|
39286
|
+
}
|
|
39287
|
+
}
|
|
39288
|
+
return {
|
|
39289
|
+
attempted,
|
|
39290
|
+
synced,
|
|
39291
|
+
failed
|
|
39292
|
+
};
|
|
39293
|
+
}
|
|
39294
|
+
|
|
39066
39295
|
// src/inline/monitor.ts
|
|
39067
39296
|
var CHANNEL_ID = "inline";
|
|
39068
|
-
var
|
|
39297
|
+
var INLINE_NATIVE_COMMAND_PROVIDER2 = CHANNEL_ID;
|
|
39298
|
+
var INLINE_NATIVE_COMMAND_CALLBACK_PREFIX = "icmd:";
|
|
39069
39299
|
var INLINE_REQUEST_ERROR_FALLBACK = "OpenClaw could not process that request. Please try again.";
|
|
39070
39300
|
var INLINE_DEBOUNCE_ERROR_FALLBACK = "OpenClaw could not process those messages. Please try again.";
|
|
39071
39301
|
function summarizeSdkMeta(meta3) {
|
|
@@ -39348,6 +39578,57 @@ function normalizeInlineCommandBody(raw, botUsername) {
|
|
|
39348
39578
|
}
|
|
39349
39579
|
return normalized;
|
|
39350
39580
|
}
|
|
39581
|
+
function findInlineNativeCommandFromBody(commandBody) {
|
|
39582
|
+
const match = commandBody.trim().match(/^\/([^\s]+)(?:\s+[\s\S]*)?$/);
|
|
39583
|
+
if (!match?.[1])
|
|
39584
|
+
return null;
|
|
39585
|
+
return findCommandByNativeName(match[1], INLINE_NATIVE_COMMAND_PROVIDER2) ?? null;
|
|
39586
|
+
}
|
|
39587
|
+
function resolveInlineCommandNameFromBody(commandBody) {
|
|
39588
|
+
const match = commandBody.trim().match(/^\/([^\s]+)(?:\s+[\s\S]*)?$/);
|
|
39589
|
+
const raw = match?.[1]?.trim().toLowerCase();
|
|
39590
|
+
return raw || null;
|
|
39591
|
+
}
|
|
39592
|
+
function buildInlineNativeCommandCallbackData(commandText) {
|
|
39593
|
+
return `${INLINE_NATIVE_COMMAND_CALLBACK_PREFIX}${commandText}`;
|
|
39594
|
+
}
|
|
39595
|
+
function parseInlineNativeCommandCallbackData(raw) {
|
|
39596
|
+
if (!raw)
|
|
39597
|
+
return null;
|
|
39598
|
+
const trimmed = raw.trim();
|
|
39599
|
+
if (!trimmed.startsWith(INLINE_NATIVE_COMMAND_CALLBACK_PREFIX))
|
|
39600
|
+
return null;
|
|
39601
|
+
const commandText = trimmed.slice(INLINE_NATIVE_COMMAND_CALLBACK_PREFIX.length).trim();
|
|
39602
|
+
return commandText.startsWith("/") ? commandText : null;
|
|
39603
|
+
}
|
|
39604
|
+
function isInlineNativeCommandBody(params) {
|
|
39605
|
+
if (!shouldSyncInlineNativeCommandsForAccount({ cfg: params.cfg, account: params.account })) {
|
|
39606
|
+
return false;
|
|
39607
|
+
}
|
|
39608
|
+
const commandName = resolveInlineCommandNameFromBody(params.commandBody);
|
|
39609
|
+
if (!commandName)
|
|
39610
|
+
return false;
|
|
39611
|
+
const skillCommands = shouldSyncInlineNativeSkillsForAccount({
|
|
39612
|
+
cfg: params.cfg,
|
|
39613
|
+
account: params.account
|
|
39614
|
+
}) ? listSkillCommandsForAgents2({
|
|
39615
|
+
cfg: params.cfg,
|
|
39616
|
+
agentIds: [params.agentId]
|
|
39617
|
+
}) : [];
|
|
39618
|
+
const commandSpecs = listNativeCommandSpecsForConfig2(params.cfg, {
|
|
39619
|
+
skillCommands,
|
|
39620
|
+
provider: INLINE_NATIVE_COMMAND_PROVIDER2
|
|
39621
|
+
});
|
|
39622
|
+
for (const spec of commandSpecs) {
|
|
39623
|
+
if (spec.name.trim().toLowerCase() === commandName)
|
|
39624
|
+
return true;
|
|
39625
|
+
}
|
|
39626
|
+
for (const spec of getPluginCommandSpecs2("inline", { config: params.cfg })) {
|
|
39627
|
+
if (spec.name.trim().toLowerCase() === commandName)
|
|
39628
|
+
return true;
|
|
39629
|
+
}
|
|
39630
|
+
return false;
|
|
39631
|
+
}
|
|
39351
39632
|
function escapeInlineRegExp(raw) {
|
|
39352
39633
|
return raw.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
39353
39634
|
}
|
|
@@ -39540,7 +39821,7 @@ function resolveInlineNativeCommandMenu(params) {
|
|
|
39540
39821
|
const match = normalized.match(/^\/([^\s]+)(?:\s+([\s\S]+))?$/);
|
|
39541
39822
|
if (!match?.[1])
|
|
39542
39823
|
return null;
|
|
39543
|
-
const command =
|
|
39824
|
+
const command = findInlineNativeCommandFromBody(normalized);
|
|
39544
39825
|
if (!command)
|
|
39545
39826
|
return null;
|
|
39546
39827
|
const args = parseCommandArgs(command, match[2]);
|
|
@@ -39573,9 +39854,9 @@ function resolveInlineNativeCommandMenu(params) {
|
|
|
39573
39854
|
const slice = menu.choices.slice(index, index + 2);
|
|
39574
39855
|
rows.push(slice.map((choice) => ({
|
|
39575
39856
|
text: choice.label,
|
|
39576
|
-
callback_data: buildCommandTextFromArgs(command, {
|
|
39857
|
+
callback_data: buildInlineNativeCommandCallbackData(buildCommandTextFromArgs(command, {
|
|
39577
39858
|
values: { [menu.arg.name]: choice.value }
|
|
39578
|
-
})
|
|
39859
|
+
}))
|
|
39579
39860
|
})));
|
|
39580
39861
|
}
|
|
39581
39862
|
return { title, buttons: rows };
|
|
@@ -39653,6 +39934,9 @@ function normalizeInlineActionCallbackData(raw) {
|
|
|
39653
39934
|
const trimmed = raw.trim();
|
|
39654
39935
|
if (!trimmed)
|
|
39655
39936
|
return "";
|
|
39937
|
+
const nativeCommandText = parseInlineNativeCommandCallbackData(trimmed);
|
|
39938
|
+
if (nativeCommandText)
|
|
39939
|
+
return nativeCommandText;
|
|
39656
39940
|
return mapInlineModelPickerCallbackToCommand(trimmed) ?? trimmed;
|
|
39657
39941
|
}
|
|
39658
39942
|
function normalizeCompatibleButtonCallbackData(raw) {
|
|
@@ -40743,6 +41027,7 @@ ${JSON.stringify(payload)}`;
|
|
|
40743
41027
|
const storeAllowList = normalizeAllowlist(storeAllowFrom);
|
|
40744
41028
|
const effectiveAllowFrom = [...configAllowFrom, ...storeAllowList].filter(Boolean);
|
|
40745
41029
|
const effectiveGroupAllowFrom = groupSenderAllowlist.expanded.filter(Boolean);
|
|
41030
|
+
const effectiveGroupCommandAllowFrom = groupSenderAllowlist.raw.length > 0 ? effectiveGroupAllowFrom : effectiveAllowFrom;
|
|
40746
41031
|
const callbackCommandBody = callbackActionEvent ? resolveCallbackCommandBodyFromActionData({
|
|
40747
41032
|
data: callbackActionEvent.data,
|
|
40748
41033
|
...botUsername ? { botUsername } : {}
|
|
@@ -40761,14 +41046,31 @@ ${JSON.stringify(payload)}`;
|
|
|
40761
41046
|
}
|
|
40762
41047
|
const shouldEditCallbackTargetInPlace = callbackActionEvent != null;
|
|
40763
41048
|
const normalizedCommandBody = callbackCommandBody ?? normalizeInlineCommandBody(rawBody, botUsername);
|
|
41049
|
+
const route = core3.channel.routing.resolveAgentRoute({
|
|
41050
|
+
cfg,
|
|
41051
|
+
channel: CHANNEL_ID,
|
|
41052
|
+
accountId: account.accountId,
|
|
41053
|
+
peer: {
|
|
41054
|
+
kind: isGroup ? "group" : "direct",
|
|
41055
|
+
id: isGroup ? String(effectiveChatId) : senderId
|
|
41056
|
+
}
|
|
41057
|
+
});
|
|
41058
|
+
const nativeCallbackCommandBody = callbackActionEvent ? parseInlineNativeCommandCallbackData(callbackDataToUtf8(callbackActionEvent.data)) : null;
|
|
41059
|
+
const hasControlCommand = core3.channel.text.hasControlCommand(callbackCommandBody ?? rawBody, cfg, botUsername ? { botUsername } : undefined);
|
|
41060
|
+
const commandSource = hasControlCommand ? (nativeCallbackCommandBody != null || !callbackActionEvent) && isInlineNativeCommandBody({
|
|
41061
|
+
cfg,
|
|
41062
|
+
account,
|
|
41063
|
+
commandBody: normalizedCommandBody,
|
|
41064
|
+
agentId: route.agentId
|
|
41065
|
+
}) ? "native" : "text" : undefined;
|
|
40764
41066
|
const allowTextCommands = core3.channel.commands.shouldHandleTextCommands({
|
|
40765
41067
|
cfg,
|
|
40766
|
-
surface: CHANNEL_ID
|
|
41068
|
+
surface: CHANNEL_ID,
|
|
41069
|
+
...commandSource ? { commandSource } : {}
|
|
40767
41070
|
});
|
|
40768
41071
|
const useAccessGroups = cfg.commands?.useAccessGroups !== false;
|
|
40769
|
-
const allowForCommands = isGroup ?
|
|
41072
|
+
const allowForCommands = isGroup ? effectiveGroupCommandAllowFrom : effectiveAllowFrom;
|
|
40770
41073
|
const senderAllowedForCommands = allowlistMatch({ allowFrom: allowForCommands, senderId });
|
|
40771
|
-
const hasControlCommand = core3.channel.text.hasControlCommand(callbackCommandBody ?? rawBody, cfg, botUsername ? { botUsername } : undefined);
|
|
40772
41074
|
const commandGate = resolveControlCommandGate({
|
|
40773
41075
|
useAccessGroups,
|
|
40774
41076
|
authorizers: [{ configured: allowForCommands.length > 0, allowed: senderAllowedForCommands }],
|
|
@@ -40871,15 +41173,6 @@ ${JSON.stringify(payload)}`;
|
|
|
40871
41173
|
});
|
|
40872
41174
|
return;
|
|
40873
41175
|
}
|
|
40874
|
-
const route = core3.channel.routing.resolveAgentRoute({
|
|
40875
|
-
cfg,
|
|
40876
|
-
channel: CHANNEL_ID,
|
|
40877
|
-
accountId: account.accountId,
|
|
40878
|
-
peer: {
|
|
40879
|
-
kind: isGroup ? "group" : "direct",
|
|
40880
|
-
id: isGroup ? String(effectiveChatId) : senderId
|
|
40881
|
-
}
|
|
40882
|
-
});
|
|
40883
41176
|
const mentionRegexes = core3.channel.mentions.buildMentionRegexes(cfg, route.agentId);
|
|
40884
41177
|
const nativeMentioned = typeof msg.mentioned === "boolean" ? msg.mentioned : false;
|
|
40885
41178
|
const patternMentioned = mentionRegexes.length ? core3.channel.mentions.matchesMentionPatterns(rawBody, mentionRegexes) : false;
|
|
@@ -40979,7 +41272,7 @@ ${JSON.stringify(payload)}`;
|
|
|
40979
41272
|
if (commandsPageCallback.page === "noop")
|
|
40980
41273
|
return;
|
|
40981
41274
|
const agentId = commandsPageCallback.agentId ?? route.agentId;
|
|
40982
|
-
const paginated = buildCommandsMessagePaginated(cfg,
|
|
41275
|
+
const paginated = buildCommandsMessagePaginated(cfg, listSkillCommandsForAgents2({
|
|
40983
41276
|
cfg,
|
|
40984
41277
|
agentIds: [agentId]
|
|
40985
41278
|
}), {
|
|
@@ -41304,6 +41597,18 @@ This model will be used for your next message.`, []);
|
|
|
41304
41597
|
Provider: CHANNEL_ID,
|
|
41305
41598
|
Surface: effectiveSurface,
|
|
41306
41599
|
MessageSid: messageSid,
|
|
41600
|
+
...commandSource ? { CommandSource: commandSource } : {},
|
|
41601
|
+
CommandTurn: commandSource ? {
|
|
41602
|
+
kind: commandSource === "native" ? "native" : "text-slash",
|
|
41603
|
+
source: commandSource,
|
|
41604
|
+
authorized: commandAuthorized,
|
|
41605
|
+
body: normalizedCommandBody
|
|
41606
|
+
} : {
|
|
41607
|
+
kind: "normal",
|
|
41608
|
+
source: "message",
|
|
41609
|
+
authorized: false,
|
|
41610
|
+
body: normalizedCommandBody
|
|
41611
|
+
},
|
|
41307
41612
|
...replyThreadContext ? { MessageThreadId: String(replyThreadContext.childChatId) } : {},
|
|
41308
41613
|
...replyThreadContext?.threadLabel ? { ThreadLabel: replyThreadContext.threadLabel } : {},
|
|
41309
41614
|
...msg.replyToMsgId != null ? { ReplyToId: String(msg.replyToMsgId) } : {},
|
|
@@ -44550,5 +44855,5 @@ export {
|
|
|
44550
44855
|
inlineChannelPlugin
|
|
44551
44856
|
};
|
|
44552
44857
|
|
|
44553
|
-
//# debugId=
|
|
44858
|
+
//# debugId=F677CBD78FB5C51A64756E2164756E21
|
|
44554
44859
|
//# sourceMappingURL=channel-plugin-api.js.map
|