Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 66
feat(agent-applications): decide principal approvals via the ingress#2851
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
52461600bf62d295141c3File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -7,6 +7,7 @@ import { | ||
| type ClientToolOutcome, | ||
| } from "@posthog/core/agent-chat/identifiers"; | ||
| import { useService } from "@posthog/di/react"; | ||
| import type { DecideApprovalRequest } from "@posthog/shared/agent-platform-types"; | ||
| import { useAuthenticatedClient } from "@posthog/ui/features/auth/authClient"; | ||
| import { toast } from "@posthog/ui/primitives/toast"; | ||
| import { useCallback, useEffect, useMemo, useRef } from "react"; | ||
| @@ -134,6 +135,17 @@ export function useAgentChat({ | ||
| [service, client, session, ingressBaseUrl], | ||
| ); | ||
| // Decide a `principal`-type tool approval for this chat at the ingress (the | ||
| // session owner clears their own gated call). The open stream resumes the | ||
| // chat on approve. | ||
| const decideApproval = useCallback( | ||
| (approvalId: string, body: DecideApprovalRequest): Promise<void> => | ||
| ingressBaseUrl | ||
| ? service.decideApproval(client, session, approvalId, body) | ||
| : Promise.resolve(), | ||
| [service, client, session, ingressBaseUrl], | ||
| ); | ||
Comment on lines
+141
to
+147
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When The | ||
| const resolveInteractiveTool = useCallback( | ||
| ( | ||
| callId: string, | ||
| @@ -165,6 +177,7 @@ export function useAgentChat({ | ||
| resume, | ||
| newChat, | ||
| resolveInteractiveTool, | ||
| decideApproval, | ||
| }; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agentApplicationsKeysis imported but the invalidation uses a raw hardcoded array. This breaks the OnceAndOnlyOnce principle maintained by the keys factory and will silently drift if the key structure changes. Use the factory instead.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!