mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-20 20:43:21 +08:00
feat: add unified IM access policies
This commit is contained in:
parent
075d2713c1
commit
840e5aa857
89 changed files with 5573 additions and 1676 deletions
|
|
@ -70,9 +70,8 @@ function compactErrorMessage(error) {
|
|||
* Unknown input returns null so the caller may continue ordinary message routing.
|
||||
*/
|
||||
export async function runCompactCommand(text, harness, state, conversationKey, options = {}) {
|
||||
if (typeof text !== 'string') return null;
|
||||
if (!isCompactCommand(text)) return null;
|
||||
const match = COMPACT_COMMAND.exec(text.trim());
|
||||
if (!match) return null;
|
||||
if (match[1].trim()) return commandResult(t(COMPACT_USAGE));
|
||||
if (typeof state?.sessionFor !== 'function') {
|
||||
return commandResult(t('当前机器人没有可用的会话状态。'));
|
||||
|
|
@ -94,3 +93,7 @@ export async function runCompactCommand(text, harness, state, conversationKey, o
|
|||
return commandResult(compactErrorMessage(error));
|
||||
}
|
||||
}
|
||||
|
||||
export function isCompactCommand(text) {
|
||||
return typeof text === 'string' && COMPACT_COMMAND.test(text.trim());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue