@parhelia/core 0.1.12760 → 0.1.12762

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from "react";
3
- import { getAgentTriggerSubscriptions, } from "../editor/services/agentService";
3
+ import { getAgentTriggerSubscriptions, isAgentReadOnly, } from "../editor/services/agentService";
4
4
  import { isAgentClosed } from "../editor/services/agentStatus";
5
5
  import { getAgentStatusConfig } from "../editor/ai/AgentStatusBadge";
6
6
  import { cn } from "../lib/utils";
@@ -176,12 +176,18 @@ export function AgentCard({ agent, onClick, onResume, onClose, onDelete, onDismi
176
176
  : formatDateTime(agent.updatedDate)] }), agent.isShared && agent.ownerName && (_jsxs("span", { className: "flex items-center gap-0.5", children: [_jsx(Users, { className: "size-2.5", strokeWidth: 2 }), "By ", agent.ownerName] })), agent.messageCount !== undefined && agent.messageCount > 0 && (_jsxs("span", { className: "flex items-center gap-0.5", children: [_jsx(MessageSquare, { className: "size-2.5", strokeWidth: 2 }), agent.messageCount, " msg"] })), loadedTriggerCount !== null && loadedTriggerCount > 0 && (_jsxs("span", { className: "flex items-center gap-0.5", children: [_jsx(Bell, { className: "size-2.5", strokeWidth: 2 }), loadedTriggerCount, " trigger", loadedTriggerCount !== 1 ? "s" : ""] })), agent.totalCost !== undefined && agent.totalCost > 0 && (_jsxs("span", { className: "flex items-center gap-0.5", children: [_jsx(Coins, { className: "size-2.5", strokeWidth: 2 }), "$", agent.totalCost.toFixed(2)] }))] })] }), _jsxs("div", { className: "flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100", children: [isClosed && (_jsx(SimpleIconButton, { onClick: (e) => {
177
177
  e.stopPropagation();
178
178
  onResume?.(agent);
179
- }, icon: _jsx(Play, { className: "size-3.5", strokeWidth: 2 }), label: "Resume Agent", className: "h-7 w-7 rounded-md text-gray-400 hover:bg-blue-50 hover:text-blue-600" })), !isClosed && !onDismiss && (_jsx(SimpleIconButton, { onClick: (e) => {
179
+ }, icon: _jsx(Play, { className: "size-3.5", strokeWidth: 2 }), label: "Resume Agent", className: "h-7 w-7 rounded-md text-gray-400 hover:bg-blue-50 hover:text-blue-600" })), !isClosed && !onDismiss && !isAgentReadOnly(agent) && (_jsx(SimpleIconButton, { onClick: (e) => {
180
180
  e.stopPropagation();
181
+ if (isAgentReadOnly(agent))
182
+ return;
181
183
  onClose?.(agent.id, agent.name);
182
184
  }, icon: _jsx(X, { className: "size-3.5", strokeWidth: 2 }), label: "Close Agent", className: "h-7 w-7 rounded-md text-gray-400 hover:bg-gray-100 hover:text-gray-600" })), onDismiss ? (_jsx(SimpleIconButton, { onClick: (e) => {
183
185
  e.stopPropagation();
184
186
  onDismiss(agent.id, agent.name);
185
- }, icon: _jsx(X, { className: "size-3.5", strokeWidth: 2 }), label: "Dismiss", className: "h-7 w-7 rounded-md text-gray-400 hover:bg-gray-100 hover:text-gray-600" })) : (_jsx(SimpleIconButton, { onClick: (e) => onDelete?.(agent.id, agent.name, e), icon: _jsx(Trash, { className: "size-3.5", strokeWidth: 2 }), label: "Delete Agent", className: "h-7 w-7 rounded-md text-gray-400 hover:bg-red-50 hover:text-red-600" }))] })] }) }, agent.id));
187
+ }, icon: _jsx(X, { className: "size-3.5", strokeWidth: 2 }), label: "Dismiss", className: "h-7 w-7 rounded-md text-gray-400 hover:bg-gray-100 hover:text-gray-600" })) : (!isAgentReadOnly(agent) && (_jsx(SimpleIconButton, { onClick: (e) => {
188
+ if (isAgentReadOnly(agent))
189
+ return;
190
+ onDelete?.(agent.id, agent.name, e);
191
+ }, icon: _jsx(Trash, { className: "size-3.5", strokeWidth: 2 }), label: "Delete Agent", className: "h-7 w-7 rounded-md text-gray-400 hover:bg-red-50 hover:text-red-600" })))] })] }) }, agent.id));
186
192
  }
187
193
  //# sourceMappingURL=AgentCard.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentCard.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AI,eAAe,CAAC,KAAK,CAAC;oCAAE,OAAO;gCACnC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;4BAClC,CAAC,EACD,IAAI,EAAE,KAAC,CAAC,IAAC,SAAS,EAAC,UAAU,EAAC,WAAW,EAAE,CAAC,GAAI,EAChD,KAAK,EAAC,aAAa,EACnB,SAAS,EAAC,wEAAwE,GAClF,CACH,EACA,SAAS,CAAC,CAAC,CAAC,CACX,KAAC,gBAAgB,IACf,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gCACb,CAAC,CAAC,eAAe,EAAE,CAAC;gCACpB,SAAS,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;4BAClC,CAAC,EACD,IAAI,EAAE,KAAC,CAAC,IAAC,SAAS,EAAC,UAAU,EAAC,WAAW,EAAE,CAAC,GAAI,EAChD,KAAK,EAAC,SAAS,EACf,SAAS,EAAC,wEAAwE,GAClF,CACH,CAAC,CAAC,CAAC,CACF,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CACzB,KAAC,gBAAgB,IACf,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gCACb,IAAI,eAAe,CAAC,KAAK,CAAC;oCAAE,OAAO;gCACnC,QAAQ,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;4BACtC,CAAC,EACD,IAAI,EAAE,KAAC,KAAK,IAAC,SAAS,EAAC,UAAU,EAAC,WAAW,EAAE,CAAC,GAAI,EACpD,KAAK,EAAC,cAAc,EACpB,SAAS,EAAC,qEAAqE,GAC/E,CACH,CACF,IACG,IACF,IA1KD,KAAK,CAAC,EAAE,CA2KT,CACP,CAAC;AACJ,CAAC"}
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import React, { useEffect, useState, useRef, useCallback, useLayoutEffect, useMemo, } from "react";
3
3
  import { flushSync } from "react-dom";
4
4
  import { Send, AlertCircle, Loader2, Wand2, Square, Mic, MicOff, ChevronDown, ChevronUp, ArrowLeft, DollarSign, ExternalLink, Settings2, Target, X, Plus, } from "lucide-react";
5
- import { getAgent, startAgent, claimAgentBrowser, cancelAgentDialog, assignAgentSkill, persistDraftAgent, updateAgentSettings, updateAgentCostLimit, updateAgentContext, getAgentSkillCatalog, getAgentAvailableTools, getAgentOperationAllowances, getAgentTriggerSubscriptions, cancelAgent, canonicalizeAgentMetadata, getPendingPrompts, getAgentDiagnostics, releaseAgentBrowser, rejectToolCall, revokeAgentSkill, } from "../services/agentService";
5
+ import { getAgent, startAgent, claimAgentBrowser, cancelAgentDialog, assignAgentSkill, persistDraftAgent, updateAgentSettings, updateAgentCostLimit, updateAgentContext, getAgentSkillCatalog, getAgentAvailableTools, getAgentOperationAllowances, getAgentTriggerSubscriptions, cancelAgent, canonicalizeAgentMetadata, getPendingPrompts, getAgentDiagnostics, releaseAgentBrowser, rejectToolCall, revokeAgentSkill, isAgentReadOnly, } from "../services/agentService";
6
6
  import { parseAgentRunStatusData, parseAgentStatus, } from "../services/agentStatus";
7
7
  import { useEditContext, useFieldsEditContext } from "../client/editContext";
8
8
  import { localStorageService } from "../services/localStorageService";
@@ -61,6 +61,9 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
61
61
  const [isLoading, setIsLoading] = useState(() => agentStub.status !== "new");
62
62
  const [isConnecting, setIsConnecting] = useState(false);
63
63
  const [isSubmitting, setIsSubmitting] = useState(false);
64
+ // Default to read-only while a persisted agent is loading so we don't briefly
65
+ // render editable controls for a viewer who only has View access.
66
+ const readOnly = isLoading ? true : isAgentReadOnly(agent);
64
67
  const [activePlaceholderInput, setActivePlaceholderInput] = useState(null);
65
68
  const [allPlaceholdersFilled, setAllPlaceholdersFilled] = useState(false);
66
69
  const [agentMetadata, setAgentMetadata] = useState(null);
@@ -985,6 +988,8 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
985
988
  return persistedAgent;
986
989
  };
987
990
  const handleAddSkill = useCallback(async (skillId) => {
991
+ if (readOnly)
992
+ return;
988
993
  if (selectedSkillSet.has(skillId.toLowerCase()))
989
994
  return;
990
995
  if (!agent?.id)
@@ -1024,6 +1029,8 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
1024
1029
  selectedSkillSet,
1025
1030
  ]);
1026
1031
  const handleRemoveSkill = useCallback(async (skillId) => {
1032
+ if (readOnly)
1033
+ return;
1027
1034
  if (!agent?.id)
1028
1035
  return;
1029
1036
  try {
@@ -3810,6 +3817,10 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
3810
3817
  }, []);
3811
3818
  const handleSubmit = async (promptOverride) => {
3812
3819
  const hasPromptOverride = promptOverride !== undefined;
3820
+ if (readOnly) {
3821
+ console.warn("[AgentTerminal] handleSubmit blocked: read-only access");
3822
+ return;
3823
+ }
3813
3824
  // Guard against double-submit and missing context
3814
3825
  if (isSubmitting) {
3815
3826
  console.warn("[AgentTerminal] handleSubmit blocked: already submitting");
@@ -4160,6 +4171,10 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
4160
4171
  };
4161
4172
  // Send a message programmatically (used by quick-action buttons)
4162
4173
  const sendQuickMessage = async (text) => {
4174
+ if (readOnly) {
4175
+ console.warn("[AgentTerminal] sendQuickMessage blocked: read-only access");
4176
+ return;
4177
+ }
4163
4178
  const savedPrompt = text.trim();
4164
4179
  if (!savedPrompt) {
4165
4180
  console.warn("[AgentTerminal] sendQuickMessage blocked: empty text");
@@ -4768,6 +4783,10 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
4768
4783
  }, [agent?.id, editContext?.sessionId, isClaimedByCurrentSession]);
4769
4784
  // Stop current execution/stream safely
4770
4785
  const handleStop = useCallback(async () => {
4786
+ if (readOnly) {
4787
+ console.warn("[AgentTerminal] handleStop blocked: read-only access");
4788
+ return;
4789
+ }
4771
4790
  try {
4772
4791
  // 1. Set the stopping guard to prevent WebSocket handlers from re-enabling states
4773
4792
  // This must happen FIRST, before any other state changes
@@ -5301,7 +5320,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
5301
5320
  return (_jsxs("div", { className: `flex h-full min-h-0 flex-col ${className || ""}`, children: [fixedBrowserClaimBanner, error &&
5302
5321
  !isAgentErrorStatusValue((agent || agentStub)?.status) && (_jsx("div", { className: "m-4 rounded-lg border-l-4 border-red-500 bg-red-50 p-3 select-text", children: _jsxs("div", { className: "flex items-start", children: [_jsx(AlertCircle, { className: "mt-0.5 h-5 w-5 text-red-400", strokeWidth: 1 }), _jsxs("div", { className: "ml-3", children: [_jsx("p", { className: "text-[11px] font-medium text-red-800", children: "Error" }), _jsx("p", { className: "mt-1 text-[11px] text-red-700", children: error })] })] }) })), renderCapacityBanner(), renderErrorBanner(), _jsxs("div", { ref: messagesContainerRef, className: "flex-1 overflow-y-auto", onScroll: handleScroll, children: [showInitialThinkingSplash && (_jsx(InitialThinkingSplash, { svgIcon: activeProfile?.svgIcon })), inlineBrowserClaimBanner, inlineDialog ? (inlineDialog) : latestSummaryAssistantGroup ? (_jsx("div", { className: "space-y-0 divide-y divide-gray-100 select-text", children: _jsx(AiResponseMessage, { messages: summaryMessages, finished: !latestSummaryAssistantGroup.isLastGroup || !isExecuting, editOperations: summaryOperations, defaultCollapseJson: defaultCollapseJson, profileSvgIcon: activeProfile?.svgIcon, agentId: agent?.id || agentStub.id, agentName: activeProfile?.agentName ||
5303
5322
  activeProfile?.displayTitle ||
5304
- activeProfile?.name, allPendingApprovals: allPendingApprovals, onSwitchToAutonomous: handleSwitchToAutonomous, browserCaptureInlinePrompt: browserCaptureInlinePrompt, onQuickAction: (action) => {
5323
+ activeProfile?.name, allPendingApprovals: allPendingApprovals, onSwitchToAutonomous: handleSwitchToAutonomous, browserCaptureInlinePrompt: browserCaptureInlinePrompt, readOnly: readOnly, onQuickAction: (action) => {
5305
5324
  const text = (action.prompt ||
5306
5325
  action.value ||
5307
5326
  action.label ||
@@ -5385,7 +5404,9 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
5385
5404
  shouldMaintainFocusRef.current = true;
5386
5405
  }, onBlur: () => {
5387
5406
  shouldMaintainFocusRef.current = false;
5388
- }, placeholder: inputPlaceholder, className: "max-h-[250px] min-h-[80px] flex-1 resize-y overflow-y-auto text-[12px] lg:max-h-[450px]", "data-testid": "agent-terminal-prompt", disabled: isSubmitting }) })), (() => {
5407
+ }, placeholder: readOnly
5408
+ ? "Read-only access — ask the owner for Full access to chat with this agent."
5409
+ : inputPlaceholder, className: "max-h-[250px] min-h-[80px] flex-1 resize-y overflow-y-auto text-[12px] lg:max-h-[450px]", "data-testid": "agent-terminal-prompt", disabled: isSubmitting || readOnly }) })), (() => {
5389
5410
  const isInPlaceholderMode = activePlaceholderInput ||
5390
5411
  (prompt && /\{\{[^{}]+\}\}|<<[^<>]+>>/.test(prompt));
5391
5412
  const placeholderShowsOwnButtons = hideBottomControls && isInPlaceholderMode;
@@ -5404,9 +5425,10 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
5404
5425
  else {
5405
5426
  handleSubmit();
5406
5427
  }
5407
- }, disabled: !isExecuting &&
5408
- !activePlaceholderInput &&
5409
- (!prompt.trim() || isSubmitting), "data-testid": "agent-send-stop-button", children: isExecuting ? "Stop" : "Send" })] }));
5428
+ }, disabled: readOnly ||
5429
+ (!isExecuting &&
5430
+ !activePlaceholderInput &&
5431
+ (!prompt.trim() || isSubmitting)), title: readOnly ? "Read-only access" : undefined, "data-testid": "agent-send-stop-button", children: isExecuting ? "Stop" : "Send" })] }));
5410
5432
  })()] })) : null] }));
5411
5433
  })()
5412
5434
  : null;
@@ -5453,7 +5475,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
5453
5475
  const operationsForGroup = getOperationsForMessageGroup(convertedMessages, agentOperations);
5454
5476
  return (_jsx(AiResponseMessage, { messages: convertedMessages, finished: !isLastGroup || !isExecuting, editOperations: operationsForGroup, defaultCollapseJson: defaultCollapseJson, profileSvgIcon: activeProfile?.svgIcon, agentId: agent?.id || agentStub.id, agentName: activeProfile?.agentName ||
5455
5477
  activeProfile?.displayTitle ||
5456
- activeProfile?.name, allPendingApprovals: allPendingApprovals, onSwitchToAutonomous: handleSwitchToAutonomous, browserCaptureInlinePrompt: browserCaptureInlinePrompt, onQuickAction: (action) => {
5478
+ activeProfile?.name, allPendingApprovals: allPendingApprovals, onSwitchToAutonomous: handleSwitchToAutonomous, browserCaptureInlinePrompt: browserCaptureInlinePrompt, readOnly: readOnly, onQuickAction: (action) => {
5457
5479
  const text = (action.prompt ||
5458
5480
  action.value ||
5459
5481
  action.label ||
@@ -5634,7 +5656,9 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
5634
5656
  shouldMaintainFocusRef.current = true;
5635
5657
  }, onBlur: () => {
5636
5658
  shouldMaintainFocusRef.current = false;
5637
- }, placeholder: inputPlaceholder, className: "max-h-[250px] min-h-[80px] flex-1 resize-y overflow-y-auto text-[12px] lg:max-h-[450px]", "data-testid": "agent-terminal-prompt", disabled: isSubmitting }) })), (() => {
5659
+ }, placeholder: readOnly
5660
+ ? "Read-only access — ask the owner for Full access to chat with this agent."
5661
+ : inputPlaceholder, className: "max-h-[250px] min-h-[80px] flex-1 resize-y overflow-y-auto text-[12px] lg:max-h-[450px]", "data-testid": "agent-terminal-prompt", disabled: isSubmitting || readOnly }) })), (() => {
5638
5662
  const isInPlaceholderMode = activePlaceholderInput ||
5639
5663
  (prompt && /\{\{[^{}]+\}\}|<<[^<>]+>>/.test(prompt));
5640
5664
  const placeholderShowsOwnButtons = hideBottomControls && isInPlaceholderMode;
@@ -5642,11 +5666,13 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
5642
5666
  return null;
5643
5667
  return (_jsxs("div", { className: cn("mt-2 flex items-stretch gap-2", hideBottomControls || simpleMode || isInPlaceholderMode
5644
5668
  ? "justify-end"
5645
- : "justify-between"), children: [!hideBottomControls && !simpleMode && !isInPlaceholderMode && (_jsxs("div", { className: "flex flex-wrap items-center justify-start gap-2", children: [_jsx(Select, { "data-testid": "agent-mode-selector", size: "xs", maxWidth: 240, className: cn("h-5 w-auto min-w-[95px] rounded border px-1.5 text-[11px] font-normal", mode === "read-only"
5669
+ : "justify-between"), children: [!hideBottomControls && !simpleMode && !isInPlaceholderMode && (_jsxs("div", { className: "flex flex-wrap items-center justify-start gap-2", children: [readOnly && (_jsx("span", { className: "shrink-0 rounded bg-gray-100 px-1 py-0.5 text-[10px] text-gray-600", title: "You have View-only access to this agent.", "data-testid": "agent-read-only-badge", children: "Read-only" })), _jsx(Select, { "data-testid": "agent-mode-selector", size: "xs", maxWidth: 240, disabled: readOnly, className: cn("h-5 w-auto min-w-[95px] rounded border px-1.5 text-[11px] font-normal", mode === "read-only"
5646
5670
  ? "border-green-300 bg-green-50! text-green-700 hover:bg-green-100!"
5647
5671
  : mode === "supervised"
5648
5672
  ? "border-amber-300 bg-amber-50! text-amber-700 hover:bg-amber-100!"
5649
5673
  : "border-red-300 bg-red-50! text-red-700 hover:bg-red-100!"), value: mode, options: modeOptions, onValueChange: async (val) => {
5674
+ if (readOnly)
5675
+ return;
5650
5676
  const nextMode = val || "supervised";
5651
5677
  const current = agentMetadata || {};
5652
5678
  const nextMeta = {
@@ -5703,7 +5729,9 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
5703
5729
  if (target?.closest('[data-help-panel="true"]')) {
5704
5730
  e.preventDefault();
5705
5731
  }
5706
- }, children: _jsxs("div", { className: "space-y-3", children: [profiles?.length > 0 && (_jsxs("div", { children: [_jsx("div", { className: "mb-1 text-[11px] font-medium text-gray-700", children: "Agent profile" }), _jsx(Select, { size: "xs", maxWidth: 300, searchable: profiles.length > 5, searchPlaceholder: "Filter profiles...", className: "h-6 w-full rounded border px-1.5 text-[11px] text-gray-500", value: activeProfile?.id || "", options: profileOptions, "data-testid": "agent-profile-selector", onValueChange: async (val) => {
5732
+ }, children: _jsxs("div", { className: "space-y-3", children: [profiles?.length > 0 && (_jsxs("div", { children: [_jsx("div", { className: "mb-1 text-[11px] font-medium text-gray-700", children: "Agent profile" }), _jsx(Select, { size: "xs", maxWidth: 300, searchable: profiles.length > 5, searchPlaceholder: "Filter profiles...", className: "h-6 w-full rounded border px-1.5 text-[11px] text-gray-500", value: activeProfile?.id || "", options: profileOptions, disabled: readOnly, "data-testid": "agent-profile-selector", onValueChange: async (val) => {
5733
+ if (readOnly)
5734
+ return;
5707
5735
  const nextProfile = profiles.find((x) => x.id === val);
5708
5736
  if (!nextProfile)
5709
5737
  return;
@@ -5755,13 +5783,17 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
5755
5783
  catch (err) {
5756
5784
  console.error("Failed to persist agent profile", err);
5757
5785
  }
5758
- } }), activeProfile && (_jsxs("div", { className: "mt-1 flex flex-wrap items-center gap-2", children: [_jsx(Button, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-[10px]", onClick: () => {
5786
+ } }), activeProfile && (_jsxs("div", { className: "mt-1 flex flex-wrap items-center gap-2", children: [_jsx(Button, { type: "button", size: "sm", variant: "outline", className: "h-6 px-2 text-[10px]", disabled: readOnly, onClick: () => {
5787
+ if (readOnly)
5788
+ return;
5759
5789
  void handleEditProfileSideBySide();
5760
5790
  setShowAgentSettings(false);
5761
5791
  }, "data-testid": "agent-profile-edit-button", children: "Edit" }), _jsxs("button", { type: "button", className: "inline-flex items-center gap-1 text-[10px] text-gray-500 hover:text-gray-700", onClick: () => {
5762
5792
  void handleOpenProfileSettings();
5763
5793
  setShowAgentSettings(false);
5764
- }, children: ["Open profile settings", _jsx(ExternalLink, { className: "h-2.5 w-2.5", strokeWidth: 1.5 })] })] }))] })), activeProfile?.models?.length ? (_jsxs("div", { children: [_jsx("div", { className: "mb-1 text-[11px] font-medium text-gray-700", children: "Model" }), _jsx(Select, { "data-testid": "agent-model-selector", size: "xs", maxWidth: 300, searchable: activeProfile.models.length > 5, searchPlaceholder: "Filter models...", className: "h-6 w-full rounded border px-1.5 text-[11px] text-gray-500", value: selectedModelId || "", options: modelOptions, onValueChange: async (val) => {
5794
+ }, children: ["Open profile settings", _jsx(ExternalLink, { className: "h-2.5 w-2.5", strokeWidth: 1.5 })] })] }))] })), activeProfile?.models?.length ? (_jsxs("div", { children: [_jsx("div", { className: "mb-1 text-[11px] font-medium text-gray-700", children: "Model" }), _jsx(Select, { "data-testid": "agent-model-selector", size: "xs", maxWidth: 300, searchable: activeProfile.models.length > 5, searchPlaceholder: "Filter models...", className: "h-6 w-full rounded border px-1.5 text-[11px] text-gray-500", value: selectedModelId || "", options: modelOptions, disabled: readOnly, onValueChange: async (val) => {
5795
+ if (readOnly)
5796
+ return;
5765
5797
  const nextId = val;
5766
5798
  setSelectedModelId(nextId);
5767
5799
  const modelName = activeProfile?.models?.find((m) => m.id === nextId)?.name || "";
@@ -5787,7 +5819,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
5787
5819
  if (open) {
5788
5820
  setSkillActionError(null);
5789
5821
  }
5790
- }, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { size: "xs", variant: "outline", className: "h-5 rounded border px-1.5 text-[10px] text-gray-600", "data-testid": "agent-skill-picker-trigger", children: [_jsx(Plus, { className: "mr-1 h-3 w-3", strokeWidth: 1.5 }), "Add"] }) }), _jsx(PopoverContent, { className: "w-88 p-2", align: "end", side: "bottom", children: _jsxs("div", { className: "space-y-2", children: [_jsx("div", { className: "text-[11px] font-medium text-gray-700", children: "Select a skill" }), _jsxs("div", { className: "relative h-56 rounded border border-gray-200 bg-gray-50", children: [_jsx(ScrollingContentTree, { rootItemIds: skillRootIds, selectedItemId: selectedSkillIds[selectedSkillIds.length - 1] || undefined, expandedItemId: selectedSkillIds[selectedSkillIds.length - 1] || skillRootIds[0], scrollToSelected: true, hideRootNodes: false, onSelectionChange: (selection) => {
5822
+ }, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsxs(Button, { size: "xs", variant: "outline", className: "h-5 rounded border px-1.5 text-[10px] text-gray-600", "data-testid": "agent-skill-picker-trigger", disabled: readOnly, title: readOnly ? "Read-only access" : undefined, children: [_jsx(Plus, { className: "mr-1 h-3 w-3", strokeWidth: 1.5 }), "Add"] }) }), _jsx(PopoverContent, { className: "w-88 p-2", align: "end", side: "bottom", children: _jsxs("div", { className: "space-y-2", children: [_jsx("div", { className: "text-[11px] font-medium text-gray-700", children: "Select a skill" }), _jsxs("div", { className: "relative h-56 rounded border border-gray-200 bg-gray-50", children: [_jsx(ScrollingContentTree, { rootItemIds: skillRootIds, selectedItemId: selectedSkillIds[selectedSkillIds.length - 1] || undefined, expandedItemId: selectedSkillIds[selectedSkillIds.length - 1] || skillRootIds[0], scrollToSelected: true, hideRootNodes: false, onSelectionChange: (selection) => {
5791
5823
  const selected = selection[0];
5792
5824
  if (!selected?.id)
5793
5825
  return;
@@ -5844,7 +5876,7 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
5844
5876
  return (_jsxs("div", { className: "flex items-baseline gap-1.5 rounded px-1 py-0.5 transition-colors hover:bg-white/60", children: [_jsx("div", { className: "shrink-0 text-[10px] font-medium text-gray-700", children: sub.triggerName }), filterText.length > 0 && (_jsx("div", { className: "truncate text-[9px] text-gray-400", title: filterText, children: filterText }))] }, sub.id));
5845
5877
  }) })) : (_jsx("div", { className: "px-1 text-[10px] text-gray-500", children: isLocalOnlyDraftAgent
5846
5878
  ? "Subscribed triggers are shown after the agent is created"
5847
- : "No active trigger subscriptions" })) })), triggerSubscriptionsError && (_jsx("div", { className: "mt-1 text-[10px] text-red-600", children: triggerSubscriptionsError }))] }), agent?.id && !isLocalOnlyDraftAgent ? (_jsx("div", { className: "border-t border-gray-200 pt-2", children: _jsx(AgentSharingSection, { agentId: agent.id, canManage: agent?.canManage ?? true }) })) : null] }) })] }), activeProfile?.prompts?.length ? (_jsxs(Popover, { open: showPredefined, onOpenChange: setShowPredefined, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { className: "rounded p-1 hover:bg-gray-100", onClick: () => { }, title: "Predefined prompts", "aria-label": "Predefined prompts", type: "button", children: _jsx(Wand2, { className: "h-3 w-3", strokeWidth: 1 }) }) }), _jsx(PopoverContent, { className: "w-64 p-0", align: "start", children: _jsx("div", { className: "max-h-56 overflow-y-auto p-2", children: activeProfile.prompts.map((p, index) => (_jsx("div", { className: "cursor-pointer rounded p-1.5 text-[10px] text-gray-700 hover:bg-gray-100", onClick: () => {
5879
+ : "No active trigger subscriptions" })) })), triggerSubscriptionsError && (_jsx("div", { className: "mt-1 text-[10px] text-red-600", children: triggerSubscriptionsError }))] }), agent?.id && !isLocalOnlyDraftAgent ? (_jsx("div", { className: "border-t border-gray-200 pt-2", children: _jsx(AgentSharingSection, { agentId: agent.id, canManage: !readOnly }) })) : null] }) })] }), activeProfile?.prompts?.length ? (_jsxs(Popover, { open: showPredefined, onOpenChange: setShowPredefined, children: [_jsx(PopoverTrigger, { asChild: true, children: _jsx("button", { className: "rounded p-1 hover:bg-gray-100", onClick: () => { }, title: "Predefined prompts", "aria-label": "Predefined prompts", type: "button", children: _jsx(Wand2, { className: "h-3 w-3", strokeWidth: 1 }) }) }), _jsx(PopoverContent, { className: "w-64 p-0", align: "start", children: _jsx("div", { className: "max-h-56 overflow-y-auto p-2", children: activeProfile.prompts.map((p, index) => (_jsx("div", { className: "cursor-pointer rounded p-1.5 text-[10px] text-gray-700 hover:bg-gray-100", onClick: () => {
5848
5880
  setPrompt(p.prompt);
5849
5881
  setShowPredefined(false);
5850
5882
  if (textareaRef.current)
@@ -5879,17 +5911,20 @@ export function AgentTerminal({ agentStub, initialMetadata, profiles, onReloadPr
5879
5911
  ? "Your browser does not support Speech Recognition"
5880
5912
  : isListening
5881
5913
  ? "Stop voice input"
5882
- : "Start voice input", "aria-pressed": isListening, "aria-disabled": isVoiceDisabled, children: isListening ? (_jsx(MicOff, { className: "size-3", strokeWidth: 1 })) : (_jsx(Mic, { className: "size-3", strokeWidth: 1 })) }) }), _jsx(Button, { onClick: isExecuting ? handleStop : () => handleSubmit(), disabled: !isExecuting &&
5883
- (allPendingApprovals.length > 0 ||
5884
- (!prompt.trim() && !activePlaceholderInput) ||
5885
- (!!prompt &&
5886
- /\{\{[^{}]+\}\}|<<[^<>]+>>/.test(prompt) &&
5887
- !allPlaceholdersFilled) ||
5888
- (!!activePlaceholderInput && !allPlaceholdersFilled)), size: "sm", className: "h-5.5 w-5.5 cursor-pointer rounded-full", title: isExecuting
5889
- ? "Stop"
5890
- : allPendingApprovals.length > 0
5891
- ? "Approve or reject pending tool calls first"
5892
- : "Send", "aria-label": isExecuting ? "Stop" : "Send", "data-testid": "agent-send-stop-button", "data-executing": isExecuting ? "true" : "false", children: isExecuting ? (_jsx(Square, { className: "size-3", strokeWidth: 1 })) : (_jsx(Send, { className: "size-3", strokeWidth: 1 })) })] })] }));
5914
+ : "Start voice input", "aria-pressed": isListening, "aria-disabled": isVoiceDisabled, children: isListening ? (_jsx(MicOff, { className: "size-3", strokeWidth: 1 })) : (_jsx(Mic, { className: "size-3", strokeWidth: 1 })) }) }), _jsx(Button, { onClick: isExecuting ? handleStop : () => handleSubmit(), disabled: readOnly ||
5915
+ (!isExecuting &&
5916
+ (allPendingApprovals.length > 0 ||
5917
+ (!prompt.trim() && !activePlaceholderInput) ||
5918
+ (!!prompt &&
5919
+ /\{\{[^{}]+\}\}|<<[^<>]+>>/.test(prompt) &&
5920
+ !allPlaceholdersFilled) ||
5921
+ (!!activePlaceholderInput && !allPlaceholdersFilled))), size: "sm", className: "h-5.5 w-5.5 cursor-pointer rounded-full", title: readOnly
5922
+ ? "Read-only access"
5923
+ : isExecuting
5924
+ ? "Stop"
5925
+ : allPendingApprovals.length > 0
5926
+ ? "Approve or reject pending tool calls first"
5927
+ : "Send", "aria-label": isExecuting ? "Stop" : "Send", "data-testid": "agent-send-stop-button", "data-executing": isExecuting ? "true" : "false", children: isExecuting ? (_jsx(Square, { className: "size-3", strokeWidth: 1 })) : (_jsx(Send, { className: "size-3", strokeWidth: 1 })) })] })] }));
5893
5928
  })(), !hideBottomControls &&
5894
5929
  !simpleMode &&
5895
5930
  editContext &&