Skip to content
⌘K
Explore
Download
Docs
Sign in
Sign up
flagon-io
/
g1t
public
Star
0
Overview
Code
Issues
8
Pull requests
3
Agents
Workflows
Deployments
Insights
Files
Commits
Branches
Tags
Releases
Compare
Commit
Agents' budget alerts and sessions waiting for approval reach the person they're for: notifications finds who to tell under target as well as at the top level.
syntaqx
committed
19h ago
Parent
2edcd6b
Browse files
334fc39a1711
1
file
+4
−1
0/1 viewed
Collapse all
Unified
Split
services/notify/src/index.ts
+4
−1
View
Blame
Viewed
44
44
}
45
45
46
46
/** A user id from the arguments, or one looked up by username. */
47
−
async function userIdOf(env: Env, args: { user_id?: unknown; username?: unknown }): Promise<string | null> {
47
+
async function userIdOf(env: Env, given: { user_id?: unknown; username?: unknown; target?: unknown }): Promise<string | null> {
48
+
// Who it's for, at the top level or under `target` as the agents service sends it.
49
+
const target = given.target && typeof given.target === "object" ? (given.target as { user_id?: unknown; username?: unknown }) : null;
50
+
const args = { user_id: given.user_id ?? target?.user_id, username: given.username ?? target?.username };
48
51
if (typeof args.user_id === "string" && args.user_id) return args.user_id;
49
52
if (typeof args.username !== "string" || !args.username) return null;
50
53
const user = await identityClient(env.IDENTITY)