@xenosystem/agent-interface-ui 0.1.11 → 0.1.13
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.
- package/dist/adapters/hubAgentPlatformBridge.d.ts +5 -6
- package/dist/adapters/hubAgentPlatformBridge.d.ts.map +1 -1
- package/dist/adapters/hubAgentPlatformBridge.js +5 -6
- package/dist/adapters/hubAgentPlatformBridge.js.map +1 -1
- package/dist/components/agent/AgentInterface.d.ts.map +1 -1
- package/dist/components/agent/AgentInterface.js +83 -14
- package/dist/components/agent/AgentInterface.js.map +1 -1
- package/package.json +5 -5
|
@@ -2,12 +2,11 @@ import type { XenoAPI } from '../platformApiTypes.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Composes a Hub renderer bridge during the incremental host migration.
|
|
4
4
|
*
|
|
5
|
-
* @unwired-by-design Hub
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* cannot have a caller until that adoption lands.
|
|
5
|
+
* @unwired-by-design Hub now mounts the complete canonical Agent surface and
|
|
6
|
+
* shared host directly, so its cutover deliberately bypasses this older
|
|
7
|
+
* incremental bridge. The exported helper remains for embedders that must
|
|
8
|
+
* migrate one host-contract slice at a time; deleting it would break the
|
|
9
|
+
* published compatibility API.
|
|
11
10
|
*
|
|
12
11
|
* Only methods with a complete AgentHostClient round trip are replaced. Every
|
|
13
12
|
* other mature Hub capability remains on the original preload object until its
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hubAgentPlatformBridge.d.ts","sourceRoot":"","sources":["../../src/adapters/hubAgentPlatformBridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAErD
|
|
1
|
+
{"version":3,"file":"hubAgentPlatformBridge.d.ts","sourceRoot":"","sources":["../../src/adapters/hubAgentPlatformBridge.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AAErD;;;;;;;;;;;;GAYG;AACH,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,OAAO,EACf,UAAU,EAAE,OAAO,GAClB,OAAO,CA6FT"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Composes a Hub renderer bridge during the incremental host migration.
|
|
3
3
|
*
|
|
4
|
-
* @unwired-by-design Hub
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* cannot have a caller until that adoption lands.
|
|
4
|
+
* @unwired-by-design Hub now mounts the complete canonical Agent surface and
|
|
5
|
+
* shared host directly, so its cutover deliberately bypasses this older
|
|
6
|
+
* incremental bridge. The exported helper remains for embedders that must
|
|
7
|
+
* migrate one host-contract slice at a time; deleting it would break the
|
|
8
|
+
* published compatibility API.
|
|
10
9
|
*
|
|
11
10
|
* Only methods with a complete AgentHostClient round trip are replaced. Every
|
|
12
11
|
* other mature Hub capability remains on the original preload object until its
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hubAgentPlatformBridge.js","sourceRoot":"","sources":["../../src/adapters/hubAgentPlatformBridge.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"hubAgentPlatformBridge.js","sourceRoot":"","sources":["../../src/adapters/hubAgentPlatformBridge.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,oCAAoC,CAClD,MAAe,EACf,UAAmB;IAEnB,OAAO;QACL,GAAG,MAAM;QACT,gBAAgB,EAAE;YAChB,GAAG,MAAM,CAAC,gBAAgB;YAC1B,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC,IAAI;YACtC,IAAI,EAAE,UAAU,CAAC,gBAAgB,CAAC,IAAI;SACvC;QACD,YAAY,EAAE;YACZ,GAAG,MAAM,CAAC,YAAY;YACtB,gBAAgB,EAAE,UAAU,CAAC,YAAY,CAAC,g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E,UAAU,GAAG,oBAAoB,CAAA;IAC3C,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,cAAc,CAAC,EAAE;QACf,UAAU,CAAC,EAAE,qBAAqB,CAAA;QAClC,UAAU,CAAC,EAAE,qBAAqB,CAAA;QAClC,OAAO,CAAC,EAAE,qBAAqB,CAAA;KAChC,CAAA;CACF;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,OAAoB,EACpB,mBAAmB,EACnB,cAAc,GACf,GAAE,mBAAwB,qBAurL1B"}
|
|
@@ -1561,6 +1561,7 @@ function loadCachedRightPanelTerminals() {
|
|
|
1561
1561
|
allowedKey: tab.allowedKey,
|
|
1562
1562
|
...(typeof tab.laneId === 'string' ? { laneId: tab.laneId } : {}),
|
|
1563
1563
|
...(typeof tab.expectedLaneRevision === 'number' ? { expectedLaneRevision: tab.expectedLaneRevision } : {}),
|
|
1564
|
+
...(tab.detached === true ? { detached: true } : {}),
|
|
1564
1565
|
output: '',
|
|
1565
1566
|
starting: false,
|
|
1566
1567
|
exited: false,
|
|
@@ -1586,6 +1587,7 @@ function persistCachedRightPanelTerminals(tabs) {
|
|
|
1586
1587
|
allowedKey: tab.allowedKey,
|
|
1587
1588
|
...(tab.laneId ? { laneId: tab.laneId } : {}),
|
|
1588
1589
|
...(typeof tab.expectedLaneRevision === 'number' ? { expectedLaneRevision: tab.expectedLaneRevision } : {}),
|
|
1590
|
+
...(tab.detached === true ? { detached: true } : {}),
|
|
1589
1591
|
}));
|
|
1590
1592
|
window.sessionStorage.setItem(RIGHT_PANEL_TERMINALS_STORAGE_KEY, JSON.stringify(serializable));
|
|
1591
1593
|
}
|
|
@@ -1599,7 +1601,7 @@ function clampRightPanelWidth(width) {
|
|
|
1599
1601
|
: Math.max(RIGHT_PANEL_MIN_WIDTH, Math.min(RIGHT_PANEL_MAX_WIDTH, window.innerWidth - 360));
|
|
1600
1602
|
return Math.min(viewportAwareMax, Math.max(RIGHT_PANEL_MIN_WIDTH, Math.round(width)));
|
|
1601
1603
|
}
|
|
1602
|
-
function FolderSidebar({ conversationId, rootDirectory, allowedDirectories, onOpenFolder, onClose, onOpenFile, activeFilePath, terminalCapabilityEnabled, terminalReady, providerSessionTuiReady, resolvedTerminalCwd, terminalTabs, onPtyInput, onPtyResize, onCreateTerminal, onCreateProviderTui, onCloseTerminal, onClearTerminal, onRestartTerminal, width, onResizeStart, }) {
|
|
1604
|
+
function FolderSidebar({ conversationId, rootDirectory, allowedDirectories, onOpenFolder, onClose, onOpenFile, activeFilePath, terminalCapabilityEnabled, terminalReady, providerSessionTuiReady, resolvedTerminalCwd, terminalTabs, onPtyInput, onPtyResize, onCreateTerminal, onCreateProviderTui, onCloseTerminal, onClearTerminal, onRestartTerminal, onStopTerminal, width, onResizeStart, }) {
|
|
1603
1605
|
const [rightPanelTab, setRightPanelTab] = useState('files');
|
|
1604
1606
|
const [browserTabs, setBrowserTabs] = useState(() => loadCachedRightPanelBrowserTabs());
|
|
1605
1607
|
const activeBrowserTabId = rightPanelTab.startsWith('browser:') ? rightPanelTab.slice('browser:'.length) : null;
|
|
@@ -1840,7 +1842,10 @@ function FolderSidebar({ conversationId, rootDirectory, allowedDirectories, onOp
|
|
|
1840
1842
|
setPanelMenuOpen(false);
|
|
1841
1843
|
}, className: "w-full px-3 py-2 text-left text-[12px] text-white/64 hover:bg-white/[0.06] hover:text-white transition-colors", children: activeTerminal.kind === 'provider-session' && activeTerminal.exited
|
|
1842
1844
|
? 'Reconcile and return to chat'
|
|
1843
|
-
: `Restart ${activeTerminal.kind === 'provider-session' ? (activeTerminal.label || 'Provider TUI') : 'PowerShell'}` }), _jsx("button", { type: "button", role: "menuitem", onClick: () => {
|
|
1845
|
+
: `Restart ${activeTerminal.kind === 'provider-session' ? (activeTerminal.label || 'Provider TUI') : 'PowerShell'}` }), activeTerminal.kind === 'provider-session' && !activeTerminal.exited ? (_jsx("button", { type: "button", role: "menuitem", onClick: () => {
|
|
1846
|
+
onStopTerminal(activeTerminal.id);
|
|
1847
|
+
setPanelMenuOpen(false);
|
|
1848
|
+
}, className: "w-full px-3 py-2 text-left text-[12px] text-red-200/70 hover:bg-red-500/[0.09] hover:text-red-100 transition-colors", children: "Stop provider session" })) : null, _jsx("button", { type: "button", role: "menuitem", onClick: () => {
|
|
1844
1849
|
onCloseTerminal(activeTerminal.id);
|
|
1845
1850
|
setPanelMenuOpen(false);
|
|
1846
1851
|
}, className: "w-full px-3 py-2 text-left text-[12px] text-red-200/70 hover:bg-red-500/[0.09] hover:text-red-100 transition-colors", children: "Close terminal tab" }), _jsx("div", { className: "my-1 h-px bg-white/[0.06]" })] })) : activeBrowser ? (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", role: "menuitem", onClick: () => {
|
|
@@ -3519,7 +3524,13 @@ export default function AgentInterface({ surface = 'embedded', initialSdkSession
|
|
|
3519
3524
|
&& activeLane?.laneId
|
|
3520
3525
|
&& !guiOwnsActiveProviderSession
|
|
3521
3526
|
&& getAgentPlatformBridge().workspace.providerNativeAttach
|
|
3522
|
-
&& (activeLane.status === 'new'
|
|
3527
|
+
&& (activeLane.status === 'new'
|
|
3528
|
+
|| activeLane.status === 'clean'
|
|
3529
|
+
|| rightPanelTerminals.some((tab) => (tab.kind === 'provider-session'
|
|
3530
|
+
&& tab.conversationId === activeConversationId
|
|
3531
|
+
&& tab.laneId === activeLane.laneId
|
|
3532
|
+
&& tab.detached === true
|
|
3533
|
+
&& !!tab.terminalId))));
|
|
3523
3534
|
const rightPanelPtyAllowedKey = useMemo(() => activeConversationAllowedDirectories.map(normalizeDirectoryPath).join('|'), [activeConversationAllowedDirectories]);
|
|
3524
3535
|
useEffect(() => {
|
|
3525
3536
|
rightPanelTerminalsRef.current = rightPanelTerminals;
|
|
@@ -3723,6 +3734,29 @@ export default function AgentInterface({ surface = 'embedded', initialSdkSession
|
|
|
3723
3734
|
&& tab.kind === 'provider-session'
|
|
3724
3735
|
&& tab.laneId === lane.laneId));
|
|
3725
3736
|
if (existing) {
|
|
3737
|
+
if (existing.detached && existing.terminalId) {
|
|
3738
|
+
const reattach = getAgentPlatformBridge().workspace.providerNativeReattach;
|
|
3739
|
+
if (!reattach)
|
|
3740
|
+
return existing.id;
|
|
3741
|
+
setRightPanelTerminals((current) => current.map((tab) => (tab.id === existing.id ? { ...tab, starting: true, detached: false } : tab)));
|
|
3742
|
+
void reattach({
|
|
3743
|
+
conversationId: activeConversationId,
|
|
3744
|
+
laneId: lane.laneId,
|
|
3745
|
+
terminalId: existing.terminalId,
|
|
3746
|
+
}).then((result) => {
|
|
3747
|
+
setRightPanelTerminals((current) => current.map((tab) => (tab.id !== existing.id
|
|
3748
|
+
? tab
|
|
3749
|
+
: result.success
|
|
3750
|
+
? { ...tab, starting: false, detached: false, exited: false }
|
|
3751
|
+
: {
|
|
3752
|
+
...tab,
|
|
3753
|
+
starting: false,
|
|
3754
|
+
detached: true,
|
|
3755
|
+
output: `${tab.output}\r\n[${result.error || 'Provider TUI reattach failed.'}]\r\n`,
|
|
3756
|
+
})));
|
|
3757
|
+
});
|
|
3758
|
+
return existing.id;
|
|
3759
|
+
}
|
|
3726
3760
|
if (existing.exited && !existing.starting) {
|
|
3727
3761
|
const cwd = existing.cwd || resolvedTerminalCwd || activeConversationAllowedDirectories[0] || '';
|
|
3728
3762
|
setRightPanelTerminals((current) => current.map((tab) => (tab.id === existing.id
|
|
@@ -3811,18 +3845,17 @@ export default function AgentInterface({ surface = 'embedded', initialSdkSession
|
|
|
3811
3845
|
&& (!activeLaneId || tab.laneId !== activeLaneId)));
|
|
3812
3846
|
for (const tab of staleProviderTabs) {
|
|
3813
3847
|
if (tab.terminalId && tab.laneId) {
|
|
3814
|
-
void getAgentPlatformBridge().workspace.
|
|
3848
|
+
void getAgentPlatformBridge().workspace.providerNativeDetach?.({
|
|
3815
3849
|
conversationId: tab.conversationId,
|
|
3816
3850
|
laneId: tab.laneId,
|
|
3817
3851
|
terminalId: tab.terminalId,
|
|
3818
|
-
reason: 'The active provider lane changed.',
|
|
3819
3852
|
});
|
|
3820
3853
|
}
|
|
3821
3854
|
}
|
|
3822
3855
|
if (staleProviderTabs.length > 0) {
|
|
3823
|
-
setRightPanelTerminals((current) => current.
|
|
3824
|
-
|
|
3825
|
-
|
|
3856
|
+
setRightPanelTerminals((current) => current.map((tab) => (staleProviderTabs.some((stale) => stale.id === tab.id)
|
|
3857
|
+
? { ...tab, detached: true, starting: false }
|
|
3858
|
+
: tab)));
|
|
3826
3859
|
}
|
|
3827
3860
|
}, [activeConversationId, activeSessionUi.activeLane?.laneId]);
|
|
3828
3861
|
const handleRightPanelPtyInput = useCallback((tabId, data) => {
|
|
@@ -3840,12 +3873,15 @@ export default function AgentInterface({ surface = 'embedded', initialSdkSession
|
|
|
3840
3873
|
const handleCloseRightPanelTerminal = useCallback((tabId) => {
|
|
3841
3874
|
const tab = rightPanelTerminalsRef.current.find((entry) => entry.id === tabId);
|
|
3842
3875
|
if (tab?.terminalId && tab.kind === 'provider-session' && tab.laneId) {
|
|
3843
|
-
|
|
3876
|
+
// Closing a tab closes a VIEW. It must not silently terminate the host-owned writer;
|
|
3877
|
+
// the same native session remains reattachable from this or another XENO surface.
|
|
3878
|
+
void getAgentPlatformBridge().workspace.providerNativeDetach?.({
|
|
3844
3879
|
conversationId: tab.conversationId,
|
|
3845
3880
|
laneId: tab.laneId,
|
|
3846
3881
|
terminalId: tab.terminalId,
|
|
3847
|
-
reason: 'The provider TUI tab was closed.',
|
|
3848
3882
|
});
|
|
3883
|
+
setRightPanelTerminals((current) => current.map((entry) => (entry.id === tabId ? { ...entry, detached: true, starting: false } : entry)));
|
|
3884
|
+
return;
|
|
3849
3885
|
}
|
|
3850
3886
|
else if (tab?.terminalId) {
|
|
3851
3887
|
void getAgentPlatformBridge().workspace.ptyStop({ terminalId: tab.terminalId });
|
|
@@ -3858,6 +3894,33 @@ export default function AgentInterface({ surface = 'embedded', initialSdkSession
|
|
|
3858
3894
|
void getAgentPlatformBridge().workspace.ptyClear({ terminalId });
|
|
3859
3895
|
setRightPanelTerminals((current) => current.map((entry) => (entry.id === tabId ? { ...entry, output: '' } : entry)));
|
|
3860
3896
|
}, []);
|
|
3897
|
+
const handleStopRightPanelTerminal = useCallback((tabId) => {
|
|
3898
|
+
const tab = rightPanelTerminalsRef.current.find((entry) => entry.id === tabId);
|
|
3899
|
+
if (!tab?.terminalId || tab.kind !== 'provider-session' || !tab.laneId)
|
|
3900
|
+
return;
|
|
3901
|
+
const stop = getAgentPlatformBridge().workspace.providerNativeStop;
|
|
3902
|
+
if (!stop)
|
|
3903
|
+
return;
|
|
3904
|
+
void stop({
|
|
3905
|
+
conversationId: tab.conversationId,
|
|
3906
|
+
laneId: tab.laneId,
|
|
3907
|
+
terminalId: tab.terminalId,
|
|
3908
|
+
reason: 'The user explicitly stopped the native provider session.',
|
|
3909
|
+
}).then((result) => {
|
|
3910
|
+
const message = result.success
|
|
3911
|
+
? 'provider session stopped; reconcile before returning to chat'
|
|
3912
|
+
: (result.error || 'Provider session stop failed.');
|
|
3913
|
+
setRightPanelTerminals((current) => current.map((entry) => (entry.id !== tabId
|
|
3914
|
+
? entry
|
|
3915
|
+
: {
|
|
3916
|
+
...entry,
|
|
3917
|
+
terminalId: result.success ? null : entry.terminalId,
|
|
3918
|
+
exited: result.success,
|
|
3919
|
+
detached: false,
|
|
3920
|
+
output: `${entry.output}\r\n[${message}]\r\n`,
|
|
3921
|
+
})));
|
|
3922
|
+
});
|
|
3923
|
+
}, []);
|
|
3861
3924
|
const handleRestartRightPanelTerminal = useCallback((tabId) => {
|
|
3862
3925
|
const tab = rightPanelTerminalsRef.current.find((entry) => entry.id === tabId);
|
|
3863
3926
|
if (!tab || tab.conversationId !== activeConversationId)
|
|
@@ -3928,13 +3991,19 @@ export default function AgentInterface({ surface = 'embedded', initialSdkSession
|
|
|
3928
3991
|
}
|
|
3929
3992
|
startRightPanelTerminal(tabId, tab.conversationId, cwd, activeConversationAllowedDirectories, undefined);
|
|
3930
3993
|
}, [activeConversationAllowedDirectories, activeConversationId, activeSessionUi.activeLane, handleCloseRightPanelTerminal, resolvedTerminalCwd, startRightPanelTerminal]);
|
|
3931
|
-
const rightPanelTerminalsForConversation = useMemo(() => (rightPanelTerminals.filter((tab) => (tab.
|
|
3994
|
+
const rightPanelTerminalsForConversation = useMemo(() => (rightPanelTerminals.filter((tab) => (tab.detached !== true &&
|
|
3995
|
+
tab.conversationId === activeConversationId &&
|
|
3932
3996
|
(tab.kind === 'provider-session'
|
|
3933
3997
|
? (activeLane?.laneId ? tab.laneId === activeLane.laneId : false)
|
|
3934
3998
|
: tab.allowedKey === rightPanelPtyAllowedKey)))), [activeConversationId, activeLane?.laneId, rightPanelPtyAllowedKey, rightPanelTerminals]);
|
|
3935
|
-
const providerSessionTuiOwnsActiveSession =
|
|
3999
|
+
const providerSessionTuiOwnsActiveSession = activeLane?.status === 'active_native'
|
|
4000
|
+
|| rightPanelTerminals.some((tab) => (tab.conversationId === activeConversationId
|
|
4001
|
+
&& tab.kind === 'provider-session'
|
|
4002
|
+
&& tab.laneId === activeLane?.laneId
|
|
4003
|
+
&& !tab.exited
|
|
4004
|
+
&& (tab.starting || !!tab.terminalId)));
|
|
3936
4005
|
const providerSessionTuiInputLockReason = providerSessionTuiOwnsActiveSession
|
|
3937
|
-
? 'Native provider TUI owns this session.
|
|
4006
|
+
? 'Native provider TUI owns this session. Reattach it or stop it explicitly before sending from chat.'
|
|
3938
4007
|
: activeLane?.status === 'externally_advanced' || activeLane?.status === 'needs_reconciliation'
|
|
3939
4008
|
? 'The native provider session advanced outside chat. Use “Reconcile and return to chat” before continuing.'
|
|
3940
4009
|
: undefined;
|
|
@@ -7964,7 +8033,7 @@ export default function AgentInterface({ surface = 'embedded', initialSdkSession
|
|
|
7964
8033
|
`subagentRunId ?? conversationId`, so the conversation id
|
|
7965
8034
|
IS the run id here. Passing anything else would ask the
|
|
7966
8035
|
host about a run it has never heard of. */
|
|
7967
|
-
reviewRunId: activeConversationId, traceMessages: traceMessages, selectedTraceMessage: selectedTraceMessage, outputEntries: outputEntries, problemEntries: problemEntries, onSelectTab: handleSelectWorkbenchTab, onClose: handleCloseWorkbenchPanel, onSelectTraceMessage: handleSelectWorkbenchTraceMessage, onOpenChatSettings: handleOpenActiveConversationSettings, onOpenChatAcpAgents: handleOpenActiveConversationAcpAgents, onOpenChatPlugins: handleOpenPluginManager, onOpenChatKnowledge: handleOpenActiveConversationKnowledge, onOpenEditorPath: handleOpenEditorPath, onOpenEditorDiff: handleOpenEditorDiff, terminalCapabilityEnabled: terminalCapabilityEnabled, terminalReady: terminalReady, resolvedTerminalCwd: resolvedTerminalCwd, terminalDraftCwd: terminalDraftCwd, terminalDraftInput: terminalDraftInput, onChangeTerminalCwd: setTerminalDraftCwd, onChangeTerminalInput: setTerminalDraftInput, onResetTerminalCwd: handleResetWorkbenchTerminalCwd, onClearTerminalHistory: handleClearWorkbenchTerminalHistory, onRunTerminalCommand: () => { void handleRunWorkbenchTerminalCommand(); }, terminalHistory: terminalHistory, liveTerminalRuns: liveTerminalRunsForConversation, onReuseTerminalEntry: handleReuseWorkbenchTerminalEntry, onStopTerminalRun: (terminalId) => { void handleStopWorkbenchTerminalRun(terminalId); }, codeWorkbench: codeWorkbenchState, onCodeQueryChange: setCodeWorkbenchQuery, onCodeModeChange: handleCodeModeChange, onCodeIndex: handleCodeIndex, onCodeSearch: handleCodeSearch, onCodeOpenPath: handleCodeOpenPath, onCodeToggleFile: handleCodeToggleFile, onCodeToggleSymbol: handleCodeToggleSymbol, onCodeCreateContextPack: () => { void handleCodeCreateContextPack(); }, onCodeMaterializeContextPack: (packId) => { void handleCodeMaterializeContextPack(packId); }, onCodeAttachContextPack: (packId) => { void handleCodeAttachContextPack(packId); }, onCodeRefreshContextPacks: () => { void handleCodeRefreshContextPacks(); }, onCodeRefreshChanges: () => { void handleCodeRefreshChanges(); }, onCodeRefreshActions: () => { void handleCodeRefreshActions(); }, onCodeApplyAction: (action) => { void handleCodeApplyAction(action); }, onCodeOrganizeImports: () => { void handleCodeOrganizeImports(); }, onCodeRenameSymbol: () => { void handleCodeRenameSymbol(); }, onCodeRefreshLanguageServices: () => { void handleCodeRefreshLanguageServices(); }, onCodeControlLanguageService: (serviceId, action) => { void handleCodeControlLanguageService(serviceId, action); }, onCodeRepairIndex: () => { void handleCodeRepairIndex(); }, engineeringWorkbench: engineeringWorkbenchState, onEngineeringRefresh: () => { void handleEngineeringRefresh(); }, onEngineeringTogglePath: handleEngineeringTogglePath, onEngineeringOpenPath: handleEngineeringOpenPath, onEngineeringPreviewDiff: (paths) => { void handleEngineeringPreviewDiff(paths); }, onEngineeringStage: (paths) => { void handleEngineeringStage(paths); }, onEngineeringUnstage: (paths) => { void handleEngineeringUnstage(paths); }, onEngineeringRunCheck: (checkId) => { void handleEngineeringRunCheck(checkId); }, onEngineeringStartBackgroundCheck: (checkId) => { void handleEngineeringStartBackgroundCheck(checkId); }, onEngineeringStopBackgroundRun: (runId) => { void handleEngineeringStopBackgroundRun(runId); }, onEngineeringReadBackgroundRunOutput: (runId) => { void handleEngineeringReadBackgroundRunOutput(runId); }, onEngineeringCommitMessageChange: setEngineeringCommitMessage, onEngineeringCommit: () => { void handleEngineeringCommit(); }, onEngineeringQueuePatchReview: () => { void handleEngineeringQueuePatchReview(); }, onEngineeringUpdatePatchReview: (id, status) => { void handleEngineeringUpdatePatchReview(id, status); }, onEngineeringReviewPatchSelection: (request) => { void handleEngineeringReviewPatchSelection(request); }, onEngineeringCompareCheckpoints: (fromCheckpointId, toCheckpointId) => { void handleEngineeringCompareCheckpoints(fromCheckpointId, toCheckpointId); }, onEngineeringRestoreCheckpoint: (checkpointId) => { void handleEngineeringRestoreCheckpoint(checkpointId); }, cliControlPlane: cliControlPlaneState, cliControlPlaneCaller: policyCaller, cliControlPlaneConversationId: activeConversationId, cliControlPlaneRemoteBackendId: selectedAgent?.runtimeSelection?.remoteBackendId || '', onCliControlPlaneInspect: () => { void handleCliControlPlaneInspect(); }, onCliControlPlaneInspectOperation: (operation) => { void handleCliControlPlaneInspectOperation(operation); }, onCliControlPlaneRemoteRunOperation: (action, runId) => { void handleCliControlPlaneRemoteRunOperation(action, runId); }, subagentWorkbench: subagentWorkbenchState, subagentDelegationTargets: subagentDelegationTargets, subagentDelegationSourceName: selectedAgent?.name, subagentDelegationDisabledReason: subagentDelegationDisabledReason, onSubagentRefresh: () => { void handleSubagentRefresh(); }, onSubagentRecoverRuns: () => { void handleSubagentRecoverRuns(); }, onSubagentSelectRun: handleSubagentSelectRun, onSubagentOpenConversation: handleSubagentOpenConversation, onSubagentCancelRun: (run) => { void handleSubagentCancelRun(run); }, onCreateSubagentDelegation: handleWorkbenchSubagentDelegation, policyWorkbench: policyWorkbenchState, onPolicyRefresh: () => { void handlePolicyRefresh(); } }) }) }) }))] })] }), folderPanelOpen && (_jsx(FolderSidebar, { conversationId: activeConversationId, rootDirectory: activeConversation?.rootDirectory || null, allowedDirectories: activeConversationAllowedDirectories, onOpenFolder: handleOpenFolderForConversation, onClose: () => setFolderPanelOpen(false), onOpenFile: handleOpenEditorFile, activeFilePath: activeEditorFilePath, terminalCapabilityEnabled: terminalCapabilityEnabled, terminalReady: terminalReady, providerSessionTuiReady: providerSessionTuiReady, resolvedTerminalCwd: resolvedTerminalCwd, terminalTabs: rightPanelTerminalsForConversation, onPtyInput: handleRightPanelPtyInput, onPtyResize: handleRightPanelPtyResize, onCreateTerminal: handleCreateRightPanelTerminal, onCreateProviderTui: handleCreateProviderSessionTui, onCloseTerminal: handleCloseRightPanelTerminal, onClearTerminal: handleClearRightPanelTerminal, onRestartTerminal: handleRestartRightPanelTerminal, width: rightPanelWidth, onResizeStart: handleRightPanelResizeStart })), rightPanelResizing && (_jsx("div", { className: "fixed inset-0 z-[9999] cursor-col-resize bg-transparent", "aria-hidden": "true" })), pendingPermission && (_jsx(PermissionDialog, { request: pendingPermission, onDecision: resolvePermission }))] }));
|
|
8036
|
+
reviewRunId: activeConversationId, traceMessages: traceMessages, selectedTraceMessage: selectedTraceMessage, outputEntries: outputEntries, problemEntries: problemEntries, onSelectTab: handleSelectWorkbenchTab, onClose: handleCloseWorkbenchPanel, onSelectTraceMessage: handleSelectWorkbenchTraceMessage, onOpenChatSettings: handleOpenActiveConversationSettings, onOpenChatAcpAgents: handleOpenActiveConversationAcpAgents, onOpenChatPlugins: handleOpenPluginManager, onOpenChatKnowledge: handleOpenActiveConversationKnowledge, onOpenEditorPath: handleOpenEditorPath, onOpenEditorDiff: handleOpenEditorDiff, terminalCapabilityEnabled: terminalCapabilityEnabled, terminalReady: terminalReady, resolvedTerminalCwd: resolvedTerminalCwd, terminalDraftCwd: terminalDraftCwd, terminalDraftInput: terminalDraftInput, onChangeTerminalCwd: setTerminalDraftCwd, onChangeTerminalInput: setTerminalDraftInput, onResetTerminalCwd: handleResetWorkbenchTerminalCwd, onClearTerminalHistory: handleClearWorkbenchTerminalHistory, onRunTerminalCommand: () => { void handleRunWorkbenchTerminalCommand(); }, terminalHistory: terminalHistory, liveTerminalRuns: liveTerminalRunsForConversation, onReuseTerminalEntry: handleReuseWorkbenchTerminalEntry, onStopTerminalRun: (terminalId) => { void handleStopWorkbenchTerminalRun(terminalId); }, codeWorkbench: codeWorkbenchState, onCodeQueryChange: setCodeWorkbenchQuery, onCodeModeChange: handleCodeModeChange, onCodeIndex: handleCodeIndex, onCodeSearch: handleCodeSearch, onCodeOpenPath: handleCodeOpenPath, onCodeToggleFile: handleCodeToggleFile, onCodeToggleSymbol: handleCodeToggleSymbol, onCodeCreateContextPack: () => { void handleCodeCreateContextPack(); }, onCodeMaterializeContextPack: (packId) => { void handleCodeMaterializeContextPack(packId); }, onCodeAttachContextPack: (packId) => { void handleCodeAttachContextPack(packId); }, onCodeRefreshContextPacks: () => { void handleCodeRefreshContextPacks(); }, onCodeRefreshChanges: () => { void handleCodeRefreshChanges(); }, onCodeRefreshActions: () => { void handleCodeRefreshActions(); }, onCodeApplyAction: (action) => { void handleCodeApplyAction(action); }, onCodeOrganizeImports: () => { void handleCodeOrganizeImports(); }, onCodeRenameSymbol: () => { void handleCodeRenameSymbol(); }, onCodeRefreshLanguageServices: () => { void handleCodeRefreshLanguageServices(); }, onCodeControlLanguageService: (serviceId, action) => { void handleCodeControlLanguageService(serviceId, action); }, onCodeRepairIndex: () => { void handleCodeRepairIndex(); }, engineeringWorkbench: engineeringWorkbenchState, onEngineeringRefresh: () => { void handleEngineeringRefresh(); }, onEngineeringTogglePath: handleEngineeringTogglePath, onEngineeringOpenPath: handleEngineeringOpenPath, onEngineeringPreviewDiff: (paths) => { void handleEngineeringPreviewDiff(paths); }, onEngineeringStage: (paths) => { void handleEngineeringStage(paths); }, onEngineeringUnstage: (paths) => { void handleEngineeringUnstage(paths); }, onEngineeringRunCheck: (checkId) => { void handleEngineeringRunCheck(checkId); }, onEngineeringStartBackgroundCheck: (checkId) => { void handleEngineeringStartBackgroundCheck(checkId); }, onEngineeringStopBackgroundRun: (runId) => { void handleEngineeringStopBackgroundRun(runId); }, onEngineeringReadBackgroundRunOutput: (runId) => { void handleEngineeringReadBackgroundRunOutput(runId); }, onEngineeringCommitMessageChange: setEngineeringCommitMessage, onEngineeringCommit: () => { void handleEngineeringCommit(); }, onEngineeringQueuePatchReview: () => { void handleEngineeringQueuePatchReview(); }, onEngineeringUpdatePatchReview: (id, status) => { void handleEngineeringUpdatePatchReview(id, status); }, onEngineeringReviewPatchSelection: (request) => { void handleEngineeringReviewPatchSelection(request); }, onEngineeringCompareCheckpoints: (fromCheckpointId, toCheckpointId) => { void handleEngineeringCompareCheckpoints(fromCheckpointId, toCheckpointId); }, onEngineeringRestoreCheckpoint: (checkpointId) => { void handleEngineeringRestoreCheckpoint(checkpointId); }, cliControlPlane: cliControlPlaneState, cliControlPlaneCaller: policyCaller, cliControlPlaneConversationId: activeConversationId, cliControlPlaneRemoteBackendId: selectedAgent?.runtimeSelection?.remoteBackendId || '', onCliControlPlaneInspect: () => { void handleCliControlPlaneInspect(); }, onCliControlPlaneInspectOperation: (operation) => { void handleCliControlPlaneInspectOperation(operation); }, onCliControlPlaneRemoteRunOperation: (action, runId) => { void handleCliControlPlaneRemoteRunOperation(action, runId); }, subagentWorkbench: subagentWorkbenchState, subagentDelegationTargets: subagentDelegationTargets, subagentDelegationSourceName: selectedAgent?.name, subagentDelegationDisabledReason: subagentDelegationDisabledReason, onSubagentRefresh: () => { void handleSubagentRefresh(); }, onSubagentRecoverRuns: () => { void handleSubagentRecoverRuns(); }, onSubagentSelectRun: handleSubagentSelectRun, onSubagentOpenConversation: handleSubagentOpenConversation, onSubagentCancelRun: (run) => { void handleSubagentCancelRun(run); }, onCreateSubagentDelegation: handleWorkbenchSubagentDelegation, policyWorkbench: policyWorkbenchState, onPolicyRefresh: () => { void handlePolicyRefresh(); } }) }) }) }))] })] }), folderPanelOpen && (_jsx(FolderSidebar, { conversationId: activeConversationId, rootDirectory: activeConversation?.rootDirectory || null, allowedDirectories: activeConversationAllowedDirectories, onOpenFolder: handleOpenFolderForConversation, onClose: () => setFolderPanelOpen(false), onOpenFile: handleOpenEditorFile, activeFilePath: activeEditorFilePath, terminalCapabilityEnabled: terminalCapabilityEnabled, terminalReady: terminalReady, providerSessionTuiReady: providerSessionTuiReady, resolvedTerminalCwd: resolvedTerminalCwd, terminalTabs: rightPanelTerminalsForConversation, onPtyInput: handleRightPanelPtyInput, onPtyResize: handleRightPanelPtyResize, onCreateTerminal: handleCreateRightPanelTerminal, onCreateProviderTui: handleCreateProviderSessionTui, onCloseTerminal: handleCloseRightPanelTerminal, onClearTerminal: handleClearRightPanelTerminal, onRestartTerminal: handleRestartRightPanelTerminal, onStopTerminal: handleStopRightPanelTerminal, width: rightPanelWidth, onResizeStart: handleRightPanelResizeStart })), rightPanelResizing && (_jsx("div", { className: "fixed inset-0 z-[9999] cursor-col-resize bg-transparent", "aria-hidden": "true" })), pendingPermission && (_jsx(PermissionDialog, { request: pendingPermission, onDecision: resolvePermission }))] }));
|
|
7968
8037
|
if (surface !== 'standalone-desktop') {
|
|
7969
8038
|
return (_jsxs("div", { className: "flex h-full w-full flex-col overflow-hidden", "data-xeno-agent-embedded-shell": "true", children: [_jsx("header", { className: "xeno-chrome-shell xeno-border-subtle h-10 flex-shrink-0 border-b", "data-xeno-agent-session-header": "embedded", "data-xeno-hub-header-style": "true", children: sessionTabsNode }), _jsx("div", { className: "min-h-0 min-w-0 flex-1", children: agentWorkspace })] }));
|
|
7970
8039
|
}
|