feat: add sessions tools and send policy
This commit is contained in:
@@ -42,6 +42,7 @@ import {
|
||||
registerAgentRunContext,
|
||||
} from "../infra/agent-events.js";
|
||||
import { defaultRuntime, type RuntimeEnv } from "../runtime.js";
|
||||
import { resolveSendPolicy } from "../sessions/send-policy.js";
|
||||
import { resolveTelegramToken } from "../telegram/token.js";
|
||||
import { normalizeE164 } from "../utils.js";
|
||||
|
||||
@@ -212,6 +213,19 @@ export async function agentCommand(
|
||||
registerAgentRunContext(sessionId, { sessionKey });
|
||||
}
|
||||
|
||||
if (opts.deliver === true) {
|
||||
const sendPolicy = resolveSendPolicy({
|
||||
cfg,
|
||||
entry: sessionEntry,
|
||||
sessionKey,
|
||||
surface: sessionEntry?.surface,
|
||||
chatType: sessionEntry?.chatType,
|
||||
});
|
||||
if (sendPolicy === "deny") {
|
||||
throw new Error("send blocked by session policy");
|
||||
}
|
||||
}
|
||||
|
||||
let resolvedThinkLevel =
|
||||
thinkOnce ??
|
||||
thinkOverride ??
|
||||
|
||||
Reference in New Issue
Block a user