Add tiers, continuation, fetch cooldown, persistent action log, voice read, batch MCP
This commit is contained in:
@@ -14,9 +14,12 @@ import {
|
||||
compareSnowflakes,
|
||||
extractMentionIds,
|
||||
formatContextLine,
|
||||
hasTier,
|
||||
isTrusted,
|
||||
parseCommand,
|
||||
parseTier,
|
||||
randomActionDelay,
|
||||
redactSecrets,
|
||||
stripMentions,
|
||||
toCachedMessage,
|
||||
type CachedMessage,
|
||||
@@ -137,4 +140,40 @@ function entry(id: number, trusted: boolean): PuppetMessage {
|
||||
});
|
||||
}
|
||||
|
||||
// timestamps in context lines
|
||||
{
|
||||
const withTime: CachedMessage = {
|
||||
...cached(1, "hi"),
|
||||
timestamp: "2026-09-11T14:03:00.000Z"
|
||||
};
|
||||
assert.match(formatContextLine(withTime), /^\[\d\d:\d\d\] a: hi$/);
|
||||
assert.equal(formatContextLine(cached(2, "no time")), "a: no time");
|
||||
}
|
||||
|
||||
// secret redaction
|
||||
{
|
||||
const fakeToken = `${"x".repeat(24)}.${"abcde"}.${"y".repeat(25)}`;
|
||||
assert.equal(redactSecrets(`token ${fakeToken} here`), "token [redacted] here");
|
||||
assert.equal(redactSecrets("mfa." + "z".repeat(30)), "[redacted]");
|
||||
assert.equal(redactSecrets("nothing to hide"), "nothing to hide");
|
||||
}
|
||||
|
||||
// trust tiers
|
||||
{
|
||||
assert.equal(hasTier("admin", "admin"), true);
|
||||
assert.equal(hasTier("trusted", "admin"), false);
|
||||
assert.equal(hasTier("trusted", "user"), true);
|
||||
assert.equal(hasTier(undefined, "user"), false);
|
||||
assert.equal(parseTier("trusted"), "trusted");
|
||||
assert.equal(parseTier("bogus"), undefined);
|
||||
}
|
||||
|
||||
// log lookup by ID
|
||||
{
|
||||
const log = new MessageLog();
|
||||
log.add({ ...entry(1, true), context: [] });
|
||||
assert.equal(log.find("1")?.id, "1");
|
||||
assert.equal(log.find("nope"), undefined);
|
||||
}
|
||||
|
||||
console.log("all communication tests passed");
|
||||
|
||||
Reference in New Issue
Block a user