Skip to content

feat(sidekick): Gleap.openSidekick, an agent in a side panel next to the page - #193

Draft
boehlerlukas wants to merge 3 commits into
masterfrom
feat/sidekick
Draft

boehlerlukas wants to merge 3 commits into
masterfrom
feat/sidekick

Conversation

@boehlerlukas

@boehlerlukas boehlerlukas commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Sidekick mode: an agent in a side panel next to the page

Gleap.openSidekick() opens Kai Support or one of the workspace's customer agents in a full-height panel on the right edge (400 px), with the page's context. The page is dimmed and blocked (overlay, the default) or pushed aside (mode: 'push'); phones get a full-screen sheet. Plan: decision 13 of the Kai re-release (contract in .handover/kai-build/sidekick.md).

API

Gleap.openSidekick({ agentId, context, initialMessage, initialQuestion, mode: 'overlay' | 'push', newConversation });
Gleap.setSidekickContext({ title, step: { id, title, index, total }, data: { plan: 'Pro' } }); // a plain object counts as data
Gleap.closeSidekick();
Gleap.isSidekickOpen();
Gleap.setSidekickProactive(false); // no proactive opens on this page
Gleap.on('sidekick-opened' | 'sidekick-closed' | 'sidekick-proactive', cb);

How it works

  • An app mode of the existing widget frame (sidekick): one frame, one connection. sidekick-open / sidekick-context go to the Messenger, which shows its SIDEKICK layout (GleapSDK/Messenger-App#268).
  • The context envelope is the same shape as Kai Copilot's (surface: 'sidekick', page route = origin + path, title, step, the app's data). Query and fragment never leave the page; sizes are capped (the server sanitises again).
  • Overlay: a dim layer blocks clicks, wheel and touch scroll; a click on it closes the panel. Push: margin-right on <html> (never a transform), only when the page keeps 720 px, else overlay.
  • Closing (x, Escape, backdrop, closeSidekick, Gleap.open() replacing it) gives the page back exactly: <html> inline styles, scroll position, focus, launcher.
  • Proactive opens: the socket announces the sidekick cap; a sidekick message from a workspace trigger opens the panel at most once per page view, never over something else, never while the person types (4 s idle, gives up after 30 s), and not again for a day after it was closed without a reply.
  • Backwards compatible: startAgent and the AI bar are untouched; a Messenger build without the sidekick cap in its ping makes openSidekick fall back to startAgent.

Verified

  • npm test: 35 suites, 595 tests (new: GleapSidekickRules.test.js, context envelope and proactive guards). npm run build passes (build outputs not committed).
  • Browser (Playwright, private stack: this branch + Messenger feat/sidekick + Server feat/rr-sidekick): overlay and push open/close with the page restored exactly, Escape and backdrop close, SPA navigation updates the chip and the next message's context, Kai Support and a custom agent answered from the page context (page, onboarding step, plan), a proactive open from an agent event trigger (once per page view, typing guard, dismissal), phone sheet, light and dark. Screenshots: .handover/kai-build/shots/sidekick/.

Not in this PR

No version bump or release. Needs GleapSDK/Messenger-App#268 deployed first (older Messenger builds fall back to startAgent) and the Server branch feat/rr-sidekick for the context and proactive opens.

🤖 Generated with Claude Code

boehlerlukas and others added 3 commits October 25, 2026 04:53
…tive guards)

What the page tells the agent (origin + path only: query and fragment never
leave the page; title, onboarding step, the app's data, bounded like the
server's sanitiser) as one envelope with Kai Copilot (surface 'sidekick'),
overlay / push / sheet by viewport, and when a proactive open may show.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t to the page

The widget frame gets a 'sidekick' app mode: a full-height panel on the right
edge (400 px; a full-screen sheet on phones) over a dim layer that blocks the
page (overlay, default) or with the page pushed aside by a margin on <html>
(push). Closes by its x, Escape, a click on the dimmed page or closeSidekick();
the page comes back exactly (inline styles, scroll, focus, launcher). The page's
context follows SPA navigation. A messenger build without the sidekick falls
back to startAgent. API: openSidekick, setSidekickContext, closeSidekick,
isSidekickOpen, setSidekickProactive; events sidekick-opened/-closed/-proactive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The socket announces the 'sidekick' cap (the server sends proactive opens only
to SDKs that do) and hands 'sidekick' messages to the manager, which shows one
at most once per page view, never over something else, never while the person
types, and not again for a day after a dismissal. The page poll keeps the open
panel's context current.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant