@agents-js/ui-components
v0.4.0
Published
Lit web components for ACP-aware chat interfaces. Drop-in surface with streaming, permissions, elicitation, auth, and theming.
Maintainers
Readme
@agents-js/ui-components
Lit web components for ACP-aware chat interfaces. Drop-in surface with streaming, permissions, elicitation, auth, and theming.
Installation
bun add @agents-js/ui-componentsAPI
Classes
AcpAuthSelectorAcpButtonAcpChatAppAcpCheckboxAcpChoicePickerAcpCodeBlockAcpColumnAcpConnectDialogAcpDateTimeInputAcpDebugPanelAcpDiffBlockAcpDividerAcpElicitationFormAcpIconAcpImageAcpMessageAcpModalAcpModelSelectorAcpOverlayStackAcpPermissionModalAcpPermissionModeSelectorAcpPlanPanelAcpPromptInputAcpRowAcpSliderAcpStatusBarAcpStreamingTextAcpTerminalEmbedAcpTextFieldAcpToolCallDetailAcpToolKindIconAcpTranscriptAcpWriteGateModalChatAppProfileManagerHostWSClientPromptHistoryStore
Functions
clearConnectPreferences— Clear stored connection preferences and profiles.clearIconRegistries— Clear all registered external icon sets, leaving only the built-in icons.createLocalStoragePromptHistoryPersistencecreatePermissionResolutiondeleteConnectProfilederiveDisplayedSessionStatusderiveFallbackModelIdderiveRuntimeNoticederiveSessionState— Derive flat component properties from an incoming SessionStateLike. This is a pure function with no side effects — the caller is responsible for applying the result to Lit reactive properties with ...isHostBridgeActiveForTargetisKnownModelIdloadConnectPreferences— Load previously saved connection preferences. Returns the active profile's preferences, ornullif nothing valid was saved.loadConnectProfilesmapModelsmapPendingElicitation— Map a rawPendingElicitation(as serialized by the gateway) into the display-onlyPendingElicitationInfoused by the browser. The gateway's JSON serializer strips theresolvefunction, so the...mapPermissionRequest— Map a raw RequestPermissionRequest object into the minimal PendingPermissionInfo shape expected by the UI components.mapRuntimeSwitchStatemapSnapshot— Extract host-relevant fields from a full ACPSessionState snapshot. The snapshot arrives as the serialized ACPSessionState. The pending permission lives atcurrentTurn.pendingPermission.requestwh...normalizeHostBridgeUrlreconcileModelSelectionregisterAllComponents— Marker function for hosts that prefer an explicitregisterAllComponents()call after importing-js/ui-components. The function body is intentionally empty. Actual<acp-*>registration is ...registerIconSet— Register an external icon set. Icons from this registry take priority over the built-in set and previously registered sets.repairActiveSavedRuntimePreferenceresolveBrowserLaunchConfigsafeCustomElement— Idempotent variant of Lit's `` decorator. Usage is identical to the Lit decorator: import { safeCustomElement } from "./safe-custom-element.ts"; ("acp-button") export class AcpButton extends LitEl...saveConnectPreferences— Save connection preferences into a named profile. IfprofileIdis omitted, a new profile is created unless the store is empty, in which case the default profile ID is used.sessionViewStateChanged— Shallow-compare twoSessionViewStateobjects. Returnstruewhen at least one top-level value differs (meaning the component should re-render).setActiveConnectProfileshouldClearStaleSessionHashshouldRepairSavedRuntimeRestorestatusCategory— Maps a session status string to a semantic category for styling.
Interfaces
AcpChoiceOptionAcpToolCallDetailData— Mirrors the shape ofActiveToolCallfrom theagents-js/a2a-clientpackage without taking a runtime dependency on it — keepsui-componentsframework-agnostic. Consumers can pass an `ActiveTool...AgentCardLike— Unified agent card shape — covers preview, snapshot, and view uses.BrowserLaunchConfigChatAppDerivedStateConnectPreferencesConnectProfileConnectProfilesStateDebugRecordLike— Debug record shape — mirrors DebugRecord from a2a-client types.ElicitationResolutionHistoryNavResultHostState— Flat state object pushed to subscribers on every relevant event.HostTurnSummaryHostWSClientOptions— Optional behaviour hooks for {HostWSClient}. All fields are optional so existingnew HostWSClient(url)call sites keep working unchanged. Omitting a hook leaves the corresponding surface inert.ModelInfoModelInfoLikePendingElicitationInfo— Minimal elicitation request shape for display purposes. Mirrors the non-function fields ofPendingElicitationon the host side (seepackages/acp-host/src/types/session.ts). The gateway's JSON s...PendingPermissionInfo— Minimal permission request shape for display purposes.PendingWriteGateInfo— Minimal write-gate shape for display purposes.PermissionOptionInfo— Permission option shape matching /sdk PermissionOption.PermissionRequestLike— Minimal shape for permission requests from acp-host.PermissionResolutionPlanEntryLike— Plan entry shape matching PlanEntryInfo from acp-host session state.ProfileManagerCallbacksProfileManagerStatePromptHistoryPersistence— A framework-agnostic prompt history store that provides up-arrow input recall. Extracted from an earlier host prompt-history state machine and generalized here. No DOM or Lit dependencies — pure Ty...PromptHistoryStoreOptionsResolveBrowserLaunchConfigOptionsRuntimeInfoRuntimeInfoLikeRuntimeModelInfoRuntimeModelLike— Model info from the runtime CLI (available before session creation).RuntimeSwitchStateSaveConnectPreferencesOptionsSessionModelsInfoSessionModelsLikeSessionStateLike— Unified session state shape — covers snapshot and view uses.TargetInspectionLikeTranscriptMessageEntryLikeTranscriptToolCallEntryLikeTranscriptToolCallEntryPayload—ActiveToolCall-shaped payload for transcript tool-call entries. Re-uses the SDK's typed shapes (ToolKind,ToolCallContent,ToolCallLocation) so receivers get spec-shaped enums and proper di...WorkflowActivityEntryStateWorkflowSurfaceActivityStateWorkflowSurfaceComposerStateWorkflowSurfaceContextWorkflowSurfaceInterruptActionStateWorkflowSurfaceInterruptStateWorkflowSurfacePlanStateWorkflowSurfaceRenderStateWorkflowSurfaceTranscriptStateWriteGateLike— Minimal shape for write gate pending state.WriteGateResolution
Types
HostStateListenerIconRegistry— Icon registry type: a record mapping icon names to SVG path data strings.PermissionModalDetailRuntimeSwitchOriginSessionViewState— SessionViewState groups the derived state fields that drive the main chat view rendering. The component stores this as a single()property with a customhasChangedguard instead of 17+ individ...TranscriptEntryLike— Discriminated union for transcript entries. Two variants today: - Message: a user or agent text message (the originalTranscriptEntryshape fromagents-js/a2a-client). Carries `role: "user"...WorkflowActivityKindWorkflowActivityStatusWorkflowSurfaceActivityPhaseWorkflowSurfaceComposerModeWorkflowSurfaceInterruptKindWorkflowSurfaceSeverityWSServerMessage— Server-to-client messages sent by the ws-bridge.
Constants
_typeFixturesacpInputStyles— Shared CSS for input and label elements used across form components. Provides consistent styling for<label>,<input>,<textarea>, and<select>elements including focus, disabled, and error...acpTheme— Shared Tokyo Night theme as CSS custom properties. Each property uses a double-var pattern: the component referencesvar(--acp-bg, #0f1117)as the compiled default, but hosts can set--acp-bgo...DEFAULT_PERMISSION_MODE_LABELS— Default label copy for each mode. Consumers can override any subset via thelabelsproperty; missing keys fall back to these values.
Exports
type AcpChoiceOption
Dependencies
@agentclientprotocol/sdk@agents-js/a2ui-types@agents-js/acp-host@agents-js/schema-utils
Peer Dependencies
lit
License
MIT
