mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-09 07:53:20 +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
21
plugin-src/host/harness-command-executor.mjs
Normal file
21
plugin-src/host/harness-command-executor.mjs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/**
|
||||
* Adapt the Host's Typert command gateway to the channel Harness client.
|
||||
* Programmatic production fixtures may omit the gateway and exercise other assembly paths.
|
||||
*/
|
||||
export function createHarnessCommandExecutor(ctx, provided) {
|
||||
if (provided !== undefined) {
|
||||
if (typeof provided !== 'function') throw new TypeError('commandExecutor must be a function');
|
||||
return provided;
|
||||
}
|
||||
const gateway = ctx?.typertGateway;
|
||||
if (!gateway) return undefined;
|
||||
if (typeof gateway.invoke !== 'function') {
|
||||
throw new TypeError('dsh-im requires a callable ctx.typertGateway');
|
||||
}
|
||||
return (sessionId, line, options = {}) => gateway.invoke({
|
||||
namespace: 'commands',
|
||||
method: 'execute',
|
||||
args: { agentId: sessionId, line },
|
||||
signal: options.signal,
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue