@inline-openclaw/inline 0.0.43 → 0.0.45
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/account-inspect-api.js +4 -2
- package/dist/account-inspect-api.js.map +3 -3
- package/dist/approval-handler.runtime.js +126 -15
- package/dist/approval-handler.runtime.js.map +5 -5
- package/dist/channel-plugin-api.js +748 -83
- package/dist/channel-plugin-api.js.map +13 -12
- package/dist/inline/bot-commands-sync.d.ts.map +1 -1
- package/dist/inline/channel.d.ts.map +1 -1
- package/dist/inline/config-schema.d.ts +2 -0
- package/dist/inline/config-schema.d.ts.map +1 -1
- package/dist/inline/doctor.d.ts.map +1 -1
- package/dist/inline/monitor.d.ts.map +1 -1
- package/dist/inline/security.d.ts.map +1 -1
- package/dist/inline/setup-surface.d.ts.map +1 -1
- package/dist/inline/threadreply-command.d.ts +31 -0
- package/dist/inline/threadreply-command.d.ts.map +1 -1
- package/dist/runtime-register-api.js +304 -165
- package/dist/runtime-register-api.js.map +7 -7
- package/dist/setup-plugin-api.js +23 -13
- package/dist/setup-plugin-api.js.map +6 -6
- package/openclaw.plugin.json +3 -3
- package/package.json +1 -1
|
@@ -6957,7 +6957,8 @@ class Chat$Type extends import_runtime4.MessageType {
|
|
|
6957
6957
|
{ no: 9, name: "date", kind: "scalar", opt: true, T: 3, L: 0 },
|
|
6958
6958
|
{ no: 10, name: "created_by", kind: "scalar", opt: true, T: 3, L: 0 },
|
|
6959
6959
|
{ no: 11, name: "parent_chat_id", kind: "scalar", opt: true, T: 3, L: 0 },
|
|
6960
|
-
{ no: 12, name: "parent_message_id", kind: "scalar", opt: true, T: 3, L: 0 }
|
|
6960
|
+
{ no: 12, name: "parent_message_id", kind: "scalar", opt: true, T: 3, L: 0 },
|
|
6961
|
+
{ no: 13, name: "untitled", kind: "scalar", opt: true, T: 8 }
|
|
6961
6962
|
]);
|
|
6962
6963
|
}
|
|
6963
6964
|
create(value) {
|
|
@@ -7009,6 +7010,9 @@ class Chat$Type extends import_runtime4.MessageType {
|
|
|
7009
7010
|
case 12:
|
|
7010
7011
|
message.parentMessageId = reader.int64().toBigInt();
|
|
7011
7012
|
break;
|
|
7013
|
+
case 13:
|
|
7014
|
+
message.untitled = reader.bool();
|
|
7015
|
+
break;
|
|
7012
7016
|
default:
|
|
7013
7017
|
let u = options.readUnknownField;
|
|
7014
7018
|
if (u === "throw")
|
|
@@ -7045,6 +7049,8 @@ class Chat$Type extends import_runtime4.MessageType {
|
|
|
7045
7049
|
writer.tag(11, import_runtime.WireType.Varint).int64(message.parentChatId);
|
|
7046
7050
|
if (message.parentMessageId !== undefined)
|
|
7047
7051
|
writer.tag(12, import_runtime.WireType.Varint).int64(message.parentMessageId);
|
|
7052
|
+
if (message.untitled !== undefined)
|
|
7053
|
+
writer.tag(13, import_runtime.WireType.Varint).bool(message.untitled);
|
|
7048
7054
|
let u = options.writeUnknownFields;
|
|
7049
7055
|
if (u !== false)
|
|
7050
7056
|
(u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
@@ -11154,6 +11160,70 @@ class GetUpdatesInput$Type extends import_runtime4.MessageType {
|
|
|
11154
11160
|
}
|
|
11155
11161
|
var GetUpdatesInput = new GetUpdatesInput$Type;
|
|
11156
11162
|
|
|
11163
|
+
class UpdateSidecars$Type extends import_runtime4.MessageType {
|
|
11164
|
+
constructor() {
|
|
11165
|
+
super("UpdateSidecars", [
|
|
11166
|
+
{ no: 1, name: "users", kind: "message", repeat: 1, T: () => User },
|
|
11167
|
+
{ no: 2, name: "chats", kind: "message", repeat: 1, T: () => Chat },
|
|
11168
|
+
{ no: 3, name: "dialogs", kind: "message", repeat: 1, T: () => Dialog },
|
|
11169
|
+
{ no: 4, name: "spaces", kind: "message", repeat: 1, T: () => Space }
|
|
11170
|
+
]);
|
|
11171
|
+
}
|
|
11172
|
+
create(value) {
|
|
11173
|
+
const message = globalThis.Object.create(this.messagePrototype);
|
|
11174
|
+
message.users = [];
|
|
11175
|
+
message.chats = [];
|
|
11176
|
+
message.dialogs = [];
|
|
11177
|
+
message.spaces = [];
|
|
11178
|
+
if (value !== undefined)
|
|
11179
|
+
import_runtime3.reflectionMergePartial(this, message, value);
|
|
11180
|
+
return message;
|
|
11181
|
+
}
|
|
11182
|
+
internalBinaryRead(reader, length, options, target) {
|
|
11183
|
+
let message = target ?? this.create(), end = reader.pos + length;
|
|
11184
|
+
while (reader.pos < end) {
|
|
11185
|
+
let [fieldNo, wireType] = reader.tag();
|
|
11186
|
+
switch (fieldNo) {
|
|
11187
|
+
case 1:
|
|
11188
|
+
message.users.push(User.internalBinaryRead(reader, reader.uint32(), options));
|
|
11189
|
+
break;
|
|
11190
|
+
case 2:
|
|
11191
|
+
message.chats.push(Chat.internalBinaryRead(reader, reader.uint32(), options));
|
|
11192
|
+
break;
|
|
11193
|
+
case 3:
|
|
11194
|
+
message.dialogs.push(Dialog.internalBinaryRead(reader, reader.uint32(), options));
|
|
11195
|
+
break;
|
|
11196
|
+
case 4:
|
|
11197
|
+
message.spaces.push(Space.internalBinaryRead(reader, reader.uint32(), options));
|
|
11198
|
+
break;
|
|
11199
|
+
default:
|
|
11200
|
+
let u = options.readUnknownField;
|
|
11201
|
+
if (u === "throw")
|
|
11202
|
+
throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
|
|
11203
|
+
let d = reader.skip(wireType);
|
|
11204
|
+
if (u !== false)
|
|
11205
|
+
(u === true ? import_runtime2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
|
|
11206
|
+
}
|
|
11207
|
+
}
|
|
11208
|
+
return message;
|
|
11209
|
+
}
|
|
11210
|
+
internalBinaryWrite(message, writer, options) {
|
|
11211
|
+
for (let i = 0;i < message.users.length; i++)
|
|
11212
|
+
User.internalBinaryWrite(message.users[i], writer.tag(1, import_runtime.WireType.LengthDelimited).fork(), options).join();
|
|
11213
|
+
for (let i = 0;i < message.chats.length; i++)
|
|
11214
|
+
Chat.internalBinaryWrite(message.chats[i], writer.tag(2, import_runtime.WireType.LengthDelimited).fork(), options).join();
|
|
11215
|
+
for (let i = 0;i < message.dialogs.length; i++)
|
|
11216
|
+
Dialog.internalBinaryWrite(message.dialogs[i], writer.tag(3, import_runtime.WireType.LengthDelimited).fork(), options).join();
|
|
11217
|
+
for (let i = 0;i < message.spaces.length; i++)
|
|
11218
|
+
Space.internalBinaryWrite(message.spaces[i], writer.tag(4, import_runtime.WireType.LengthDelimited).fork(), options).join();
|
|
11219
|
+
let u = options.writeUnknownFields;
|
|
11220
|
+
if (u !== false)
|
|
11221
|
+
(u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
11222
|
+
return writer;
|
|
11223
|
+
}
|
|
11224
|
+
}
|
|
11225
|
+
var UpdateSidecars = new UpdateSidecars$Type;
|
|
11226
|
+
|
|
11157
11227
|
class GetUpdatesResult$Type extends import_runtime4.MessageType {
|
|
11158
11228
|
constructor() {
|
|
11159
11229
|
super("GetUpdatesResult", [
|
|
@@ -11161,7 +11231,8 @@ class GetUpdatesResult$Type extends import_runtime4.MessageType {
|
|
|
11161
11231
|
{ no: 2, name: "seq", kind: "scalar", T: 3, L: 0 },
|
|
11162
11232
|
{ no: 3, name: "date", kind: "scalar", T: 3, L: 0 },
|
|
11163
11233
|
{ no: 4, name: "final", kind: "scalar", opt: true, T: 8 },
|
|
11164
|
-
{ no: 5, name: "result_type", kind: "enum", T: () => ["GetUpdatesResult.ResultType", GetUpdatesResult_ResultType, "RESULT_TYPE_"] }
|
|
11234
|
+
{ no: 5, name: "result_type", kind: "enum", T: () => ["GetUpdatesResult.ResultType", GetUpdatesResult_ResultType, "RESULT_TYPE_"] },
|
|
11235
|
+
{ no: 6, name: "sidecars", kind: "message", T: () => UpdateSidecars }
|
|
11165
11236
|
]);
|
|
11166
11237
|
}
|
|
11167
11238
|
create(value) {
|
|
@@ -11194,6 +11265,9 @@ class GetUpdatesResult$Type extends import_runtime4.MessageType {
|
|
|
11194
11265
|
case 5:
|
|
11195
11266
|
message.resultType = reader.int32();
|
|
11196
11267
|
break;
|
|
11268
|
+
case 6:
|
|
11269
|
+
message.sidecars = UpdateSidecars.internalBinaryRead(reader, reader.uint32(), options, message.sidecars);
|
|
11270
|
+
break;
|
|
11197
11271
|
default:
|
|
11198
11272
|
let u = options.readUnknownField;
|
|
11199
11273
|
if (u === "throw")
|
|
@@ -11216,6 +11290,8 @@ class GetUpdatesResult$Type extends import_runtime4.MessageType {
|
|
|
11216
11290
|
writer.tag(4, import_runtime.WireType.Varint).bool(message.final);
|
|
11217
11291
|
if (message.resultType !== 0)
|
|
11218
11292
|
writer.tag(5, import_runtime.WireType.Varint).int32(message.resultType);
|
|
11293
|
+
if (message.sidecars)
|
|
11294
|
+
UpdateSidecars.internalBinaryWrite(message.sidecars, writer.tag(6, import_runtime.WireType.LengthDelimited).fork(), options).join();
|
|
11219
11295
|
let u = options.writeUnknownFields;
|
|
11220
11296
|
if (u !== false)
|
|
11221
11297
|
(u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
@@ -15942,7 +16018,7 @@ var ReserveChatIdsResult = new ReserveChatIdsResult$Type;
|
|
|
15942
16018
|
class CreateChatInput$Type extends import_runtime4.MessageType {
|
|
15943
16019
|
constructor() {
|
|
15944
16020
|
super("CreateChatInput", [
|
|
15945
|
-
{ no: 1, name: "title", kind: "scalar", T: 9 },
|
|
16021
|
+
{ no: 1, name: "title", kind: "scalar", opt: true, T: 9 },
|
|
15946
16022
|
{ no: 2, name: "space_id", kind: "scalar", opt: true, T: 3, L: 0 },
|
|
15947
16023
|
{ no: 3, name: "description", kind: "scalar", opt: true, T: 9 },
|
|
15948
16024
|
{ no: 4, name: "emoji", kind: "scalar", opt: true, T: 9 },
|
|
@@ -15953,7 +16029,6 @@ class CreateChatInput$Type extends import_runtime4.MessageType {
|
|
|
15953
16029
|
}
|
|
15954
16030
|
create(value) {
|
|
15955
16031
|
const message = globalThis.Object.create(this.messagePrototype);
|
|
15956
|
-
message.title = "";
|
|
15957
16032
|
message.isPublic = false;
|
|
15958
16033
|
message.participants = [];
|
|
15959
16034
|
if (value !== undefined)
|
|
@@ -15998,7 +16073,7 @@ class CreateChatInput$Type extends import_runtime4.MessageType {
|
|
|
15998
16073
|
return message;
|
|
15999
16074
|
}
|
|
16000
16075
|
internalBinaryWrite(message, writer, options) {
|
|
16001
|
-
if (message.title !==
|
|
16076
|
+
if (message.title !== undefined)
|
|
16002
16077
|
writer.tag(1, import_runtime.WireType.LengthDelimited).string(message.title);
|
|
16003
16078
|
if (message.spaceId !== undefined)
|
|
16004
16079
|
writer.tag(2, import_runtime.WireType.Varint).int64(message.spaceId);
|
|
@@ -16848,7 +16923,8 @@ class UpdateChatInfo$Type extends import_runtime4.MessageType {
|
|
|
16848
16923
|
super("UpdateChatInfo", [
|
|
16849
16924
|
{ no: 1, name: "chat_id", kind: "scalar", T: 3, L: 0 },
|
|
16850
16925
|
{ no: 2, name: "title", kind: "scalar", opt: true, T: 9 },
|
|
16851
|
-
{ no: 3, name: "emoji", kind: "scalar", opt: true, T: 9 }
|
|
16926
|
+
{ no: 3, name: "emoji", kind: "scalar", opt: true, T: 9 },
|
|
16927
|
+
{ no: 4, name: "untitled", kind: "scalar", opt: true, T: 8 }
|
|
16852
16928
|
]);
|
|
16853
16929
|
}
|
|
16854
16930
|
create(value) {
|
|
@@ -16872,6 +16948,9 @@ class UpdateChatInfo$Type extends import_runtime4.MessageType {
|
|
|
16872
16948
|
case 3:
|
|
16873
16949
|
message.emoji = reader.string();
|
|
16874
16950
|
break;
|
|
16951
|
+
case 4:
|
|
16952
|
+
message.untitled = reader.bool();
|
|
16953
|
+
break;
|
|
16875
16954
|
default:
|
|
16876
16955
|
let u = options.readUnknownField;
|
|
16877
16956
|
if (u === "throw")
|
|
@@ -16890,6 +16969,8 @@ class UpdateChatInfo$Type extends import_runtime4.MessageType {
|
|
|
16890
16969
|
writer.tag(2, import_runtime.WireType.LengthDelimited).string(message.title);
|
|
16891
16970
|
if (message.emoji !== undefined)
|
|
16892
16971
|
writer.tag(3, import_runtime.WireType.LengthDelimited).string(message.emoji);
|
|
16972
|
+
if (message.untitled !== undefined)
|
|
16973
|
+
writer.tag(4, import_runtime.WireType.Varint).bool(message.untitled);
|
|
16893
16974
|
let u = options.writeUnknownFields;
|
|
16894
16975
|
if (u !== false)
|
|
16895
16976
|
(u == true ? import_runtime2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
|
|
@@ -20955,7 +21036,7 @@ class InlineSdkClient {
|
|
|
20955
21036
|
await this.handleUpdate(update);
|
|
20956
21037
|
}
|
|
20957
21038
|
}
|
|
20958
|
-
async handleUpdate(update) {
|
|
21039
|
+
async handleUpdate(update, options) {
|
|
20959
21040
|
const seq = update.seq ?? 0;
|
|
20960
21041
|
const date = update.date ?? 0n;
|
|
20961
21042
|
switch (update.update.oneofKind) {
|
|
@@ -21087,6 +21168,34 @@ class InlineSdkClient {
|
|
|
21087
21168
|
});
|
|
21088
21169
|
return;
|
|
21089
21170
|
}
|
|
21171
|
+
case "participantAdd": {
|
|
21172
|
+
const payload = update.update.participantAdd;
|
|
21173
|
+
if (options?.source !== "user" && options?.source !== "space") {
|
|
21174
|
+
this.bumpChatSeq(payload.chatId, seq);
|
|
21175
|
+
}
|
|
21176
|
+
await this.eventStream.send({
|
|
21177
|
+
kind: "chat.participant.add",
|
|
21178
|
+
chatId: payload.chatId,
|
|
21179
|
+
...payload.participant ? { participant: payload.participant } : {},
|
|
21180
|
+
seq,
|
|
21181
|
+
date
|
|
21182
|
+
});
|
|
21183
|
+
return;
|
|
21184
|
+
}
|
|
21185
|
+
case "participantDelete": {
|
|
21186
|
+
const payload = update.update.participantDelete;
|
|
21187
|
+
if (options?.source !== "user" && options?.source !== "space") {
|
|
21188
|
+
this.bumpChatSeq(payload.chatId, seq);
|
|
21189
|
+
}
|
|
21190
|
+
await this.eventStream.send({
|
|
21191
|
+
kind: "chat.participant.delete",
|
|
21192
|
+
chatId: payload.chatId,
|
|
21193
|
+
userId: payload.userId,
|
|
21194
|
+
seq,
|
|
21195
|
+
date
|
|
21196
|
+
});
|
|
21197
|
+
return;
|
|
21198
|
+
}
|
|
21090
21199
|
case "messageActionInvoked": {
|
|
21091
21200
|
const payload = update.update.messageActionInvoked;
|
|
21092
21201
|
if (this.shouldSkipUserSeq(seq)) {
|
|
@@ -21187,14 +21296,14 @@ class InlineSdkClient {
|
|
|
21187
21296
|
}
|
|
21188
21297
|
}
|
|
21189
21298
|
requestCatchUpUser() {
|
|
21190
|
-
const lastUserSeq = this.state.lastUserSeq
|
|
21191
|
-
if (lastUserSeq
|
|
21299
|
+
const lastUserSeq = this.state.lastUserSeq;
|
|
21300
|
+
if (lastUserSeq == null && !this.options.catchUpUserFromStart) {
|
|
21192
21301
|
return;
|
|
21193
21302
|
}
|
|
21194
21303
|
if (this.userCatchUpInFlight) {
|
|
21195
21304
|
return;
|
|
21196
21305
|
}
|
|
21197
|
-
this.userCatchUpInFlight = this.doCatchUpUser(lastUserSeq).catch((error) => {
|
|
21306
|
+
this.userCatchUpInFlight = this.doCatchUpUser(lastUserSeq ?? 0).catch((error) => {
|
|
21198
21307
|
this.log.warn?.("GET_UPDATES user catch-up failed; continuing live delivery", {
|
|
21199
21308
|
error: extractErrorMessage(error)
|
|
21200
21309
|
});
|
|
@@ -21235,7 +21344,7 @@ class InlineSdkClient {
|
|
|
21235
21344
|
return;
|
|
21236
21345
|
}
|
|
21237
21346
|
for (const update of payload.updates) {
|
|
21238
|
-
await this.handleUpdate(update);
|
|
21347
|
+
await this.handleUpdate(update, { source: "user" });
|
|
21239
21348
|
}
|
|
21240
21349
|
this.bumpUserSeq(deliveredSeq);
|
|
21241
21350
|
if (payload.date !== 0n) {
|
|
@@ -21334,7 +21443,7 @@ class InlineSdkClient {
|
|
|
21334
21443
|
}
|
|
21335
21444
|
this.bumpChatSeq(chatId, deliveredSeq);
|
|
21336
21445
|
for (const update of payload.updates) {
|
|
21337
|
-
await this.handleUpdate(update);
|
|
21446
|
+
await this.handleUpdate(update, { source: "chat" });
|
|
21338
21447
|
}
|
|
21339
21448
|
if (payload.date !== 0n) {
|
|
21340
21449
|
this.state.dateCursor = payload.date;
|
|
@@ -21436,7 +21545,7 @@ class InlineSdkClient {
|
|
|
21436
21545
|
}
|
|
21437
21546
|
this.bumpSpaceSeq(spaceId, deliveredSeq);
|
|
21438
21547
|
for (const update of payload.updates) {
|
|
21439
|
-
await this.handleUpdate(update);
|
|
21548
|
+
await this.handleUpdate(update, { source: "space" });
|
|
21440
21549
|
}
|
|
21441
21550
|
if (payload.date !== 0n) {
|
|
21442
21551
|
this.state.dateCursor = payload.date;
|
|
@@ -36371,6 +36480,8 @@ var InlineExecApprovalsSchema = exports_external.object({
|
|
|
36371
36480
|
var InlineReactionNotificationsSchema = exports_external.enum(["off", "own", "all", "allowlist"]);
|
|
36372
36481
|
var InlineStreamingModeSchema = exports_external.enum(["off", "partial", "block", "progress"]);
|
|
36373
36482
|
var InlineStreamingCommandTextSchema = exports_external.enum(["raw", "status"]);
|
|
36483
|
+
var INLINE_DEFAULT_GROUP_POLICY = "open";
|
|
36484
|
+
var INLINE_DEFAULT_REQUIRE_MENTION = true;
|
|
36374
36485
|
var InlineStreamingChunkSchema = exports_external.object({
|
|
36375
36486
|
minChars: exports_external.number().int().positive().optional(),
|
|
36376
36487
|
maxChars: exports_external.number().int().positive().optional(),
|
|
@@ -36442,7 +36553,7 @@ var InlineAccountSchemaBase = exports_external.object({
|
|
|
36442
36553
|
defaultTo: InlineTargetSchema.optional(),
|
|
36443
36554
|
systemPrompt: exports_external.string().optional(),
|
|
36444
36555
|
groupAllowFrom: exports_external.array(InlineAllowEntrySchema).optional(),
|
|
36445
|
-
groupPolicy: GroupPolicySchema.optional().default(
|
|
36556
|
+
groupPolicy: GroupPolicySchema.optional().default(INLINE_DEFAULT_GROUP_POLICY),
|
|
36446
36557
|
groups: exports_external.record(exports_external.string(), InlineGroupSchema.optional()).optional(),
|
|
36447
36558
|
requireMention: exports_external.boolean().optional(),
|
|
36448
36559
|
replyThreadMode: InlineReplyThreadModeSchema.optional(),
|
|
@@ -38793,148 +38904,6 @@ import { listNativeCommandSpecsForConfig } from "openclaw/plugin-sdk/native-comm
|
|
|
38793
38904
|
import { getPluginCommandSpecs } from "openclaw/plugin-sdk/plugin-runtime";
|
|
38794
38905
|
import { resolveAgentRoute } from "openclaw/plugin-sdk/routing";
|
|
38795
38906
|
import { listSkillCommandsForAgents } from "openclaw/plugin-sdk/skill-commands-runtime";
|
|
38796
|
-
var INLINE_COMMAND_NAME_RE = /^[a-z0-9_]{1,32}$/;
|
|
38797
|
-
var INLINE_COMMAND_LIMIT = 100;
|
|
38798
|
-
var INLINE_COMMAND_DESCRIPTION_LIMIT = 256;
|
|
38799
|
-
var INLINE_NATIVE_COMMAND_PROVIDER = "inline";
|
|
38800
|
-
function normalizeDynamicCommandName(raw) {
|
|
38801
|
-
const trimmed = raw.trim().toLowerCase();
|
|
38802
|
-
const withoutSlash = trimmed.startsWith("/") ? trimmed.slice(1) : trimmed;
|
|
38803
|
-
return withoutSlash.trim();
|
|
38804
|
-
}
|
|
38805
|
-
function appendUniqueCommand(out, seen, command, description, logger) {
|
|
38806
|
-
const normalized = normalizeDynamicCommandName(command);
|
|
38807
|
-
if (!INLINE_COMMAND_NAME_RE.test(normalized) || seen.has(normalized))
|
|
38808
|
-
return;
|
|
38809
|
-
const rawDescription = adaptInlineVisibleCopy(description).trim();
|
|
38810
|
-
const trimmedDescription = rawDescription.length > INLINE_COMMAND_DESCRIPTION_LIMIT ? rawDescription.slice(0, INLINE_COMMAND_DESCRIPTION_LIMIT).trimEnd() : rawDescription;
|
|
38811
|
-
if (!trimmedDescription)
|
|
38812
|
-
return;
|
|
38813
|
-
if (trimmedDescription.length !== rawDescription.length) {
|
|
38814
|
-
logger?.warn?.(`[inline] bot command sync truncated description for /${normalized} to ${INLINE_COMMAND_DESCRIPTION_LIMIT} characters`);
|
|
38815
|
-
}
|
|
38816
|
-
seen.add(normalized);
|
|
38817
|
-
out.push({ command: normalized, description: trimmedDescription });
|
|
38818
|
-
}
|
|
38819
|
-
function shouldSyncInlineNativeCommandsForAccount(params) {
|
|
38820
|
-
const effective = params.account.config.commands?.native ?? params.cfg.commands?.native ?? "auto";
|
|
38821
|
-
return effective !== false;
|
|
38822
|
-
}
|
|
38823
|
-
function shouldSyncInlineNativeSkillsForAccount(params) {
|
|
38824
|
-
const effective = params.account.config.commands?.nativeSkills ?? params.cfg.commands?.nativeSkills ?? "auto";
|
|
38825
|
-
return effective !== false;
|
|
38826
|
-
}
|
|
38827
|
-
async function buildInlineNativeCommandsForConfig(params) {
|
|
38828
|
-
const route = shouldSyncInlineNativeSkillsForAccount({ cfg: params.cfg, account: params.account }) ? resolveAgentRoute({
|
|
38829
|
-
cfg: params.cfg,
|
|
38830
|
-
channel: INLINE_NATIVE_COMMAND_PROVIDER,
|
|
38831
|
-
accountId: params.account.accountId
|
|
38832
|
-
}) : null;
|
|
38833
|
-
const skillCommands = route ? listSkillCommandsForAgents({
|
|
38834
|
-
cfg: params.cfg,
|
|
38835
|
-
agentIds: [route.agentId]
|
|
38836
|
-
}) : [];
|
|
38837
|
-
const nativeSpecs = listNativeCommandSpecsForConfig(params.cfg, {
|
|
38838
|
-
skillCommands,
|
|
38839
|
-
provider: INLINE_NATIVE_COMMAND_PROVIDER
|
|
38840
|
-
});
|
|
38841
|
-
const pluginSpecs = getPluginCommandSpecs("inline", { config: params.cfg });
|
|
38842
|
-
const seen = new Set;
|
|
38843
|
-
const resolved = [];
|
|
38844
|
-
for (const spec of nativeSpecs) {
|
|
38845
|
-
appendUniqueCommand(resolved, seen, spec.name, spec.description, params.logger);
|
|
38846
|
-
}
|
|
38847
|
-
for (const spec of pluginSpecs) {
|
|
38848
|
-
appendUniqueCommand(resolved, seen, spec.name, spec.description, params.logger);
|
|
38849
|
-
}
|
|
38850
|
-
return resolved;
|
|
38851
|
-
}
|
|
38852
|
-
async function syncInlineNativeCommands(params) {
|
|
38853
|
-
const accountIds = listInlineAccountIds(params.cfg);
|
|
38854
|
-
if (!accountIds.length) {
|
|
38855
|
-
params.logger?.info?.("[inline] bot command sync disabled");
|
|
38856
|
-
return { attempted: 0, synced: 0, failed: 0 };
|
|
38857
|
-
}
|
|
38858
|
-
let attempted = 0;
|
|
38859
|
-
let synced = 0;
|
|
38860
|
-
let failed = 0;
|
|
38861
|
-
for (const accountId of accountIds) {
|
|
38862
|
-
const account = resolveInlineAccount({ cfg: params.cfg, accountId });
|
|
38863
|
-
const nativeEnabled = shouldSyncInlineNativeCommandsForAccount({ cfg: params.cfg, account });
|
|
38864
|
-
attempted += 1;
|
|
38865
|
-
if (!account.enabled || !account.configured || !account.baseUrl) {
|
|
38866
|
-
continue;
|
|
38867
|
-
}
|
|
38868
|
-
const ownerAccountId = findInlineTokenOwnerAccountId({
|
|
38869
|
-
cfg: params.cfg,
|
|
38870
|
-
accountId: account.accountId
|
|
38871
|
-
});
|
|
38872
|
-
if (ownerAccountId) {
|
|
38873
|
-
failed += 1;
|
|
38874
|
-
params.logger?.warn?.(`[inline] bot command sync skipped for account "${account.accountId}": ${formatDuplicateInlineTokenReason({
|
|
38875
|
-
accountId: account.accountId,
|
|
38876
|
-
ownerAccountId
|
|
38877
|
-
})}`);
|
|
38878
|
-
continue;
|
|
38879
|
-
}
|
|
38880
|
-
let token;
|
|
38881
|
-
try {
|
|
38882
|
-
token = await resolveInlineToken(account);
|
|
38883
|
-
} catch (err) {
|
|
38884
|
-
failed += 1;
|
|
38885
|
-
params.logger?.warn?.(`[inline] bot command sync skipped for account "${account.accountId}": ${String(err)}`);
|
|
38886
|
-
continue;
|
|
38887
|
-
}
|
|
38888
|
-
if (!nativeEnabled) {
|
|
38889
|
-
try {
|
|
38890
|
-
await callInlineBotApi({
|
|
38891
|
-
baseUrl: account.baseUrl,
|
|
38892
|
-
token,
|
|
38893
|
-
methodName: "deleteMyCommands",
|
|
38894
|
-
method: "POST"
|
|
38895
|
-
});
|
|
38896
|
-
synced += 1;
|
|
38897
|
-
params.logger?.info?.(`[inline] bot commands cleared for account "${account.accountId}"`);
|
|
38898
|
-
} catch (err) {
|
|
38899
|
-
failed += 1;
|
|
38900
|
-
params.logger?.warn?.(`[inline] bot command clear failed for account "${account.accountId}": ${String(err)}`);
|
|
38901
|
-
}
|
|
38902
|
-
continue;
|
|
38903
|
-
}
|
|
38904
|
-
const allCommands = await buildInlineNativeCommandsForConfig({
|
|
38905
|
-
cfg: params.cfg,
|
|
38906
|
-
account,
|
|
38907
|
-
...params.logger ? { logger: params.logger } : {}
|
|
38908
|
-
});
|
|
38909
|
-
const commands = allCommands.slice(0, INLINE_COMMAND_LIMIT);
|
|
38910
|
-
if (allCommands.length > INLINE_COMMAND_LIMIT) {
|
|
38911
|
-
params.logger?.warn?.(`[inline] bot command sync truncating ${allCommands.length} commands to ${INLINE_COMMAND_LIMIT}`);
|
|
38912
|
-
}
|
|
38913
|
-
if (commands.length === 0) {
|
|
38914
|
-
params.logger?.warn?.(`[inline] bot command sync skipped for account "${account.accountId}": no valid commands resolved`);
|
|
38915
|
-
continue;
|
|
38916
|
-
}
|
|
38917
|
-
try {
|
|
38918
|
-
await callInlineBotApi({
|
|
38919
|
-
baseUrl: account.baseUrl,
|
|
38920
|
-
token,
|
|
38921
|
-
methodName: "setMyCommands",
|
|
38922
|
-
method: "POST",
|
|
38923
|
-
body: { commands }
|
|
38924
|
-
});
|
|
38925
|
-
synced += 1;
|
|
38926
|
-
params.logger?.info?.(`[inline] bot commands synced for account "${account.accountId}" (${commands.length} command${commands.length === 1 ? "" : "s"})`);
|
|
38927
|
-
} catch (err) {
|
|
38928
|
-
failed += 1;
|
|
38929
|
-
params.logger?.warn?.(`[inline] bot command sync failed for account "${account.accountId}": ${String(err)}`);
|
|
38930
|
-
}
|
|
38931
|
-
}
|
|
38932
|
-
return {
|
|
38933
|
-
attempted,
|
|
38934
|
-
synced,
|
|
38935
|
-
failed
|
|
38936
|
-
};
|
|
38937
|
-
}
|
|
38938
38907
|
|
|
38939
38908
|
// src/inline/policy.ts
|
|
38940
38909
|
function normalizeAccountId2(raw) {
|
|
@@ -39114,6 +39083,23 @@ var MODE_LABELS = {
|
|
|
39114
39083
|
main: "main"
|
|
39115
39084
|
};
|
|
39116
39085
|
var DEFAULT_REPLY_THREAD_AUTO_CREATE_MIN_MESSAGES = 50;
|
|
39086
|
+
var INLINE_THREADREPLY_NATIVE_NAME = "threadreply";
|
|
39087
|
+
var INLINE_THREADREPLY_COMMAND_SPEC = {
|
|
39088
|
+
name: "threadreply",
|
|
39089
|
+
nativeNames: { inline: INLINE_THREADREPLY_NATIVE_NAME },
|
|
39090
|
+
description: "Set Inline reply-thread mode for this chat.",
|
|
39091
|
+
channels: ["inline"],
|
|
39092
|
+
acceptsArgs: true
|
|
39093
|
+
};
|
|
39094
|
+
function listInlineBuiltinCommandSpecs() {
|
|
39095
|
+
return [
|
|
39096
|
+
{
|
|
39097
|
+
name: INLINE_THREADREPLY_COMMAND_SPEC.nativeNames.inline ?? INLINE_THREADREPLY_COMMAND_SPEC.name,
|
|
39098
|
+
description: INLINE_THREADREPLY_COMMAND_SPEC.description,
|
|
39099
|
+
acceptsArgs: INLINE_THREADREPLY_COMMAND_SPEC.acceptsArgs
|
|
39100
|
+
}
|
|
39101
|
+
];
|
|
39102
|
+
}
|
|
39117
39103
|
function isRecord3(value) {
|
|
39118
39104
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
39119
39105
|
}
|
|
@@ -39311,6 +39297,9 @@ function normalizeAction(args) {
|
|
|
39311
39297
|
return normalizeMode(normalized);
|
|
39312
39298
|
}
|
|
39313
39299
|
async function handleInlineThreadReplyCommand(api2, ctx) {
|
|
39300
|
+
return await handleInlineThreadReplyCommandWithConfigRuntime(api2.runtime.config, ctx);
|
|
39301
|
+
}
|
|
39302
|
+
async function handleInlineThreadReplyCommandWithConfigRuntime(configRuntime, ctx) {
|
|
39314
39303
|
if (!ctx.isAuthorizedSender) {
|
|
39315
39304
|
return { text: "This command requires authorization." };
|
|
39316
39305
|
}
|
|
@@ -39318,7 +39307,7 @@ async function handleInlineThreadReplyCommand(api2, ctx) {
|
|
|
39318
39307
|
if (!groupId) {
|
|
39319
39308
|
return { text: "/threadreply is only available in Inline group chats." };
|
|
39320
39309
|
}
|
|
39321
|
-
const currentConfig =
|
|
39310
|
+
const currentConfig = configRuntime.current();
|
|
39322
39311
|
const args = ctx.args?.trim() ?? "";
|
|
39323
39312
|
const [first = "", second, ...rest] = args.split(/\s+/).filter(Boolean);
|
|
39324
39313
|
if (["min", "minimum", "threshold", "limit"].includes(first.trim().toLowerCase())) {
|
|
@@ -39326,7 +39315,7 @@ async function handleInlineThreadReplyCommand(api2, ctx) {
|
|
|
39326
39315
|
if (minMessages == null || rest.length > 0) {
|
|
39327
39316
|
return { text: "Usage: /threadreply min <0-or-greater>|inherit" };
|
|
39328
39317
|
}
|
|
39329
|
-
const committed2 = await
|
|
39318
|
+
const committed2 = await configRuntime.mutateConfigFile({
|
|
39330
39319
|
afterWrite: { mode: "auto" },
|
|
39331
39320
|
mutate: (draft) => {
|
|
39332
39321
|
setGroupMinMessages({
|
|
@@ -39381,7 +39370,7 @@ async function handleInlineThreadReplyCommand(api2, ctx) {
|
|
|
39381
39370
|
`)
|
|
39382
39371
|
};
|
|
39383
39372
|
}
|
|
39384
|
-
const committed = await
|
|
39373
|
+
const committed = await configRuntime.mutateConfigFile({
|
|
39385
39374
|
afterWrite: { mode: "auto" },
|
|
39386
39375
|
mutate: (draft) => {
|
|
39387
39376
|
setGroupMode({
|
|
@@ -39403,15 +39392,165 @@ async function handleInlineThreadReplyCommand(api2, ctx) {
|
|
|
39403
39392
|
}
|
|
39404
39393
|
function createInlineThreadReplyCommand(api2) {
|
|
39405
39394
|
return {
|
|
39406
|
-
|
|
39407
|
-
nativeNames: { inline: "threadreply" },
|
|
39408
|
-
description: "Set Inline reply-thread mode for this chat.",
|
|
39409
|
-
channels: ["inline"],
|
|
39410
|
-
acceptsArgs: true,
|
|
39395
|
+
...INLINE_THREADREPLY_COMMAND_SPEC,
|
|
39411
39396
|
handler: async (ctx) => await handleInlineThreadReplyCommand(api2, ctx)
|
|
39412
39397
|
};
|
|
39413
39398
|
}
|
|
39414
39399
|
|
|
39400
|
+
// src/inline/bot-commands-sync.ts
|
|
39401
|
+
var INLINE_COMMAND_NAME_RE = /^[a-z0-9_]{1,32}$/;
|
|
39402
|
+
var INLINE_COMMAND_LIMIT = 100;
|
|
39403
|
+
var INLINE_COMMAND_DESCRIPTION_LIMIT = 256;
|
|
39404
|
+
var INLINE_NATIVE_COMMAND_PROVIDER = "inline";
|
|
39405
|
+
function resolveInlineChannelCommands(cfg) {
|
|
39406
|
+
const inline = cfg.channels?.inline;
|
|
39407
|
+
if (typeof inline !== "object" || inline === null || Array.isArray(inline))
|
|
39408
|
+
return;
|
|
39409
|
+
const commands = inline.commands;
|
|
39410
|
+
return typeof commands === "object" && commands !== null && !Array.isArray(commands) ? commands : undefined;
|
|
39411
|
+
}
|
|
39412
|
+
function normalizeDynamicCommandName(raw) {
|
|
39413
|
+
const trimmed = raw.trim().toLowerCase();
|
|
39414
|
+
const withoutSlash = trimmed.startsWith("/") ? trimmed.slice(1) : trimmed;
|
|
39415
|
+
return withoutSlash.trim();
|
|
39416
|
+
}
|
|
39417
|
+
function appendUniqueCommand(out, seen, command, description, logger) {
|
|
39418
|
+
const normalized = normalizeDynamicCommandName(command);
|
|
39419
|
+
if (!INLINE_COMMAND_NAME_RE.test(normalized) || seen.has(normalized))
|
|
39420
|
+
return;
|
|
39421
|
+
const rawDescription = adaptInlineVisibleCopy(description).trim();
|
|
39422
|
+
const trimmedDescription = rawDescription.length > INLINE_COMMAND_DESCRIPTION_LIMIT ? rawDescription.slice(0, INLINE_COMMAND_DESCRIPTION_LIMIT).trimEnd() : rawDescription;
|
|
39423
|
+
if (!trimmedDescription)
|
|
39424
|
+
return;
|
|
39425
|
+
if (trimmedDescription.length !== rawDescription.length) {
|
|
39426
|
+
logger?.warn?.(`[inline] bot command sync truncated description for /${normalized} to ${INLINE_COMMAND_DESCRIPTION_LIMIT} characters`);
|
|
39427
|
+
}
|
|
39428
|
+
seen.add(normalized);
|
|
39429
|
+
out.push({ command: normalized, description: trimmedDescription });
|
|
39430
|
+
}
|
|
39431
|
+
function shouldSyncInlineNativeCommandsForAccount(params) {
|
|
39432
|
+
const effective = params.account.config.commands?.native ?? resolveInlineChannelCommands(params.cfg)?.native ?? params.cfg.commands?.native ?? "auto";
|
|
39433
|
+
return effective !== false;
|
|
39434
|
+
}
|
|
39435
|
+
function shouldSyncInlineNativeSkillsForAccount(params) {
|
|
39436
|
+
const effective = params.account.config.commands?.nativeSkills ?? resolveInlineChannelCommands(params.cfg)?.nativeSkills ?? params.cfg.commands?.nativeSkills ?? "auto";
|
|
39437
|
+
return effective !== false;
|
|
39438
|
+
}
|
|
39439
|
+
async function buildInlineNativeCommandsForConfig(params) {
|
|
39440
|
+
const route = shouldSyncInlineNativeSkillsForAccount({ cfg: params.cfg, account: params.account }) ? resolveAgentRoute({
|
|
39441
|
+
cfg: params.cfg,
|
|
39442
|
+
channel: INLINE_NATIVE_COMMAND_PROVIDER,
|
|
39443
|
+
accountId: params.account.accountId
|
|
39444
|
+
}) : null;
|
|
39445
|
+
const skillCommands = route ? listSkillCommandsForAgents({
|
|
39446
|
+
cfg: params.cfg,
|
|
39447
|
+
agentIds: [route.agentId]
|
|
39448
|
+
}) : [];
|
|
39449
|
+
const nativeSpecs = listNativeCommandSpecsForConfig(params.cfg, {
|
|
39450
|
+
skillCommands,
|
|
39451
|
+
provider: INLINE_NATIVE_COMMAND_PROVIDER
|
|
39452
|
+
});
|
|
39453
|
+
const pluginSpecs = [
|
|
39454
|
+
...getPluginCommandSpecs("inline", { config: params.cfg }),
|
|
39455
|
+
...listInlineBuiltinCommandSpecs()
|
|
39456
|
+
];
|
|
39457
|
+
const seen = new Set;
|
|
39458
|
+
const resolved = [];
|
|
39459
|
+
for (const spec of nativeSpecs) {
|
|
39460
|
+
appendUniqueCommand(resolved, seen, spec.name, spec.description, params.logger);
|
|
39461
|
+
}
|
|
39462
|
+
for (const spec of pluginSpecs) {
|
|
39463
|
+
appendUniqueCommand(resolved, seen, spec.name, spec.description, params.logger);
|
|
39464
|
+
}
|
|
39465
|
+
return resolved;
|
|
39466
|
+
}
|
|
39467
|
+
async function syncInlineNativeCommands(params) {
|
|
39468
|
+
const accountIds = listInlineAccountIds(params.cfg);
|
|
39469
|
+
if (!accountIds.length) {
|
|
39470
|
+
params.logger?.info?.("[inline] bot command sync disabled");
|
|
39471
|
+
return { attempted: 0, synced: 0, failed: 0 };
|
|
39472
|
+
}
|
|
39473
|
+
let attempted = 0;
|
|
39474
|
+
let synced = 0;
|
|
39475
|
+
let failed = 0;
|
|
39476
|
+
for (const accountId of accountIds) {
|
|
39477
|
+
const account = resolveInlineAccount({ cfg: params.cfg, accountId });
|
|
39478
|
+
const nativeEnabled = shouldSyncInlineNativeCommandsForAccount({ cfg: params.cfg, account });
|
|
39479
|
+
attempted += 1;
|
|
39480
|
+
if (!account.enabled || !account.configured || !account.baseUrl) {
|
|
39481
|
+
continue;
|
|
39482
|
+
}
|
|
39483
|
+
const ownerAccountId = findInlineTokenOwnerAccountId({
|
|
39484
|
+
cfg: params.cfg,
|
|
39485
|
+
accountId: account.accountId
|
|
39486
|
+
});
|
|
39487
|
+
if (ownerAccountId) {
|
|
39488
|
+
failed += 1;
|
|
39489
|
+
params.logger?.warn?.(`[inline] bot command sync skipped for account "${account.accountId}": ${formatDuplicateInlineTokenReason({
|
|
39490
|
+
accountId: account.accountId,
|
|
39491
|
+
ownerAccountId
|
|
39492
|
+
})}`);
|
|
39493
|
+
continue;
|
|
39494
|
+
}
|
|
39495
|
+
let token;
|
|
39496
|
+
try {
|
|
39497
|
+
token = await resolveInlineToken(account);
|
|
39498
|
+
} catch (err) {
|
|
39499
|
+
failed += 1;
|
|
39500
|
+
params.logger?.warn?.(`[inline] bot command sync skipped for account "${account.accountId}": ${String(err)}`);
|
|
39501
|
+
continue;
|
|
39502
|
+
}
|
|
39503
|
+
if (!nativeEnabled) {
|
|
39504
|
+
try {
|
|
39505
|
+
await callInlineBotApi({
|
|
39506
|
+
baseUrl: account.baseUrl,
|
|
39507
|
+
token,
|
|
39508
|
+
methodName: "deleteMyCommands",
|
|
39509
|
+
method: "POST"
|
|
39510
|
+
});
|
|
39511
|
+
synced += 1;
|
|
39512
|
+
params.logger?.info?.(`[inline] bot commands cleared for account "${account.accountId}"`);
|
|
39513
|
+
} catch (err) {
|
|
39514
|
+
failed += 1;
|
|
39515
|
+
params.logger?.warn?.(`[inline] bot command clear failed for account "${account.accountId}": ${String(err)}`);
|
|
39516
|
+
}
|
|
39517
|
+
continue;
|
|
39518
|
+
}
|
|
39519
|
+
const allCommands = await buildInlineNativeCommandsForConfig({
|
|
39520
|
+
cfg: params.cfg,
|
|
39521
|
+
account,
|
|
39522
|
+
...params.logger ? { logger: params.logger } : {}
|
|
39523
|
+
});
|
|
39524
|
+
const commands = allCommands.slice(0, INLINE_COMMAND_LIMIT);
|
|
39525
|
+
if (allCommands.length > INLINE_COMMAND_LIMIT) {
|
|
39526
|
+
params.logger?.warn?.(`[inline] bot command sync truncating ${allCommands.length} commands to ${INLINE_COMMAND_LIMIT}`);
|
|
39527
|
+
}
|
|
39528
|
+
if (commands.length === 0) {
|
|
39529
|
+
params.logger?.warn?.(`[inline] bot command sync skipped for account "${account.accountId}": no valid commands resolved`);
|
|
39530
|
+
continue;
|
|
39531
|
+
}
|
|
39532
|
+
try {
|
|
39533
|
+
await callInlineBotApi({
|
|
39534
|
+
baseUrl: account.baseUrl,
|
|
39535
|
+
token,
|
|
39536
|
+
methodName: "setMyCommands",
|
|
39537
|
+
method: "POST",
|
|
39538
|
+
body: { commands }
|
|
39539
|
+
});
|
|
39540
|
+
synced += 1;
|
|
39541
|
+
params.logger?.info?.(`[inline] bot commands synced for account "${account.accountId}" (${commands.length} command${commands.length === 1 ? "" : "s"})`);
|
|
39542
|
+
} catch (err) {
|
|
39543
|
+
failed += 1;
|
|
39544
|
+
params.logger?.warn?.(`[inline] bot command sync failed for account "${account.accountId}": ${String(err)}`);
|
|
39545
|
+
}
|
|
39546
|
+
}
|
|
39547
|
+
return {
|
|
39548
|
+
attempted,
|
|
39549
|
+
synced,
|
|
39550
|
+
failed
|
|
39551
|
+
};
|
|
39552
|
+
}
|
|
39553
|
+
|
|
39415
39554
|
// src/runtime-register-api.ts
|
|
39416
39555
|
function registerInlinePluginFull(api2) {
|
|
39417
39556
|
api2.registerTool((ctx) => createInlineMembersTool(ctx), {
|
|
@@ -39460,5 +39599,5 @@ export {
|
|
|
39460
39599
|
registerInlinePluginFull
|
|
39461
39600
|
};
|
|
39462
39601
|
|
|
39463
|
-
//# debugId=
|
|
39602
|
+
//# debugId=5BA7B51393DC41BD64756E2164756E21
|
|
39464
39603
|
//# sourceMappingURL=runtime-register-api.js.map
|