mirror of
https://github.com/hansjone/dsh-im-ops.git
synced 2026-10-09 01:53:21 +08:00
Make WhatsApp member presets follow channel mapping by default.
Some checks failed
CI / Test, build, and verify package (push) Has been cancelled
Some checks failed
CI / Test, build, and verify package (push) Has been cancelled
Empty member/group Agent Preset now resolves to the bot workspace mapping (not Host global); settings label is Follow channel mapping, and /new createSession carries that mapping explicitly. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
f1d85d2985
commit
bcbe85fdb1
10 changed files with 182 additions and 131 deletions
|
|
@ -16,6 +16,7 @@ import {
|
|||
resolveAccessPending,
|
||||
upsertAccessContact,
|
||||
resolveAccessAgentPreset,
|
||||
resolveChatAgentPreset,
|
||||
validateAccessGrant,
|
||||
} from '../../../src/channels/shared/access-grant.mjs';
|
||||
|
||||
|
|
@ -233,7 +234,7 @@ test('quote approval helpers parse intent, pending id, and notify refs', () => {
|
|||
});
|
||||
|
||||
|
||||
test('resolveAccessAgentPreset prefers direct-member and group overrides over global', () => {
|
||||
test('resolveAccessAgentPreset prefers direct-member and group overrides over channel mapping', () => {
|
||||
const doc = grant({
|
||||
directMembers: [
|
||||
{ phone: '8618222222222', canExecuteCommands: true, agentPreset: 'ops-user' },
|
||||
|
|
@ -266,6 +267,31 @@ test('resolveAccessAgentPreset prefers direct-member and group overrides over gl
|
|||
}), null);
|
||||
});
|
||||
|
||||
test('resolveChatAgentPreset falls back to bot/channel mapping, not Host global', () => {
|
||||
const doc = grant({
|
||||
directMembers: [
|
||||
{ phone: '8618222222222', canExecuteCommands: true, agentPreset: 'ops-user' },
|
||||
{ phone: '8618333333333', canExecuteCommands: true },
|
||||
],
|
||||
});
|
||||
assert.equal(resolveChatAgentPreset(doc, {
|
||||
kind: 'direct',
|
||||
phone: '8618222222222',
|
||||
}, 'wa-mapped'), 'ops-user');
|
||||
assert.equal(resolveChatAgentPreset(doc, {
|
||||
kind: 'direct',
|
||||
phone: '8618333333333',
|
||||
}, 'wa-mapped'), 'wa-mapped');
|
||||
assert.equal(resolveChatAgentPreset(doc, {
|
||||
kind: 'direct',
|
||||
phone: '8618333333333',
|
||||
}, null), null);
|
||||
assert.equal(resolveChatAgentPreset(null, {
|
||||
kind: 'direct',
|
||||
phone: '8618333333333',
|
||||
}, 'wa-mapped'), 'wa-mapped');
|
||||
});
|
||||
|
||||
test('validateAccessGrant keeps optional agentPreset on members and groups', () => {
|
||||
const doc = grant({
|
||||
directMembers: [{ phone: '8618222222222', canExecuteCommands: false, agentPreset: 'desk' }],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue