mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-12 13:00:44 +08:00
feat: support compact command across IM channels
This commit is contained in:
parent
4545cfe9c5
commit
1cc7a26f30
40 changed files with 728 additions and 136 deletions
|
|
@ -668,6 +668,19 @@ export function createBotWorkspaceScope(harness, { botId, workspaces, state }) {
|
|||
return target.ask(sessionId, ...args);
|
||||
};
|
||||
}
|
||||
if (property === 'executeCommand' && typeof target.executeCommand === 'function') {
|
||||
return (sessionId, ...args) => {
|
||||
const generation = sessionGenerations.get(sessionId);
|
||||
sessionGenerations.delete(sessionId);
|
||||
if (!isCurrentScope()
|
||||
|| (generation !== undefined && generation !== workspaces.generationFor(botId))) {
|
||||
const error = new Error('The bot workspace changed before this command started.');
|
||||
error.code = WORKSPACE_SESSION_STALE;
|
||||
throw error;
|
||||
}
|
||||
return target.executeCommand(sessionId, ...args);
|
||||
};
|
||||
}
|
||||
const value = Reflect.get(target, property, target);
|
||||
return typeof value === 'function' ? value.bind(target) : value;
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue