@xenosystem/agent-interface-panel 0.1.36 → 0.1.37
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/index.d.ts.map +1 -1
- package/dist/index.js +30 -3
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AASzE,OAAO,EAML,KAAK,0BAA0B,EAChC,MAAM,gCAAgC,CAAA;AAEvC;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAKH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAA;AASzE,OAAO,EAML,KAAK,0BAA0B,EAChC,MAAM,gCAAgC,CAAA;AAEvC;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAA;AA8D5C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,WAAW,oCAAoC;IACnD;;;;;;;;;;OAUG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC,0BAA0B,CAAC,CAAA;IAClD;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IAC/D;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,uBAAuB,GAAG,IAAI,GAAG,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAA;IAC7F,6FAA6F;IAC7F,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAA;CACnC;AAED,6CAA6C;AAC7C,eAAO,MAAM,mBAAmB,EAAG,aAAsB,CAAA;AAEzD;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,oCAAoC,GAC5C,WAAW,CAuFb"}
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
*
|
|
39
39
|
* @packageDocumentation
|
|
40
40
|
*/
|
|
41
|
-
import { createElement } from 'react';
|
|
41
|
+
import { createElement, useCallback, useEffect, useState } from 'react';
|
|
42
42
|
import { createRoot } from 'react-dom/client';
|
|
43
43
|
import { createAgentPanel } from '@xenosystem/panel-agent';
|
|
44
44
|
import { mountXenoAgentInterface } from '@xenosystem/agent-interface-embed';
|
|
@@ -63,6 +63,33 @@ import { MAIN_ASSISTANT_ID, MAIN_ASSISTANT_MODEL, MAIN_ASSISTANT_NAME, XenoAgent
|
|
|
63
63
|
* nothing else. The host supplies the surrounding chrome, because the host already has some.
|
|
64
64
|
*/
|
|
65
65
|
const AgentConversationComponent = XenoAgentConversation;
|
|
66
|
+
/**
|
|
67
|
+
* The panel OWNS which conversation it shows.
|
|
68
|
+
*
|
|
69
|
+
* 🔴 It used to render the conversation once, with fixed props and no `onNavigateConversation`, so every
|
|
70
|
+
* way the conversation moves somewhere else was dead inside a panel host: "New chat" never rendered,
|
|
71
|
+
* opening a delegated sub-agent from the dock's tray did nothing, and a sub-agent's "Back to parent
|
|
72
|
+
* agent" never appeared. The Turn Modes Bench measurement found it — its chat frame has a New chat
|
|
73
|
+
* action the panel could not draw. Now the panel keeps the current conversation as state, moves itself,
|
|
74
|
+
* and still tells a host that wants to know.
|
|
75
|
+
*/
|
|
76
|
+
function PanelConversation(props) {
|
|
77
|
+
const { conversationId: named, onNavigateConversation, onConversationCreated } = props;
|
|
78
|
+
const [conversationId, setConversationId] = useState(named);
|
|
79
|
+
// a host that names a DIFFERENT conversation later still wins
|
|
80
|
+
useEffect(() => { if (named !== undefined)
|
|
81
|
+
setConversationId(named); }, [named]);
|
|
82
|
+
const navigate = useCallback((id) => { setConversationId(id); onNavigateConversation?.(id); }, [onNavigateConversation]);
|
|
83
|
+
// a conversation the view creates for itself becomes the panel's current one
|
|
84
|
+
const created = useCallback((id) => { setConversationId(id); onConversationCreated?.(id); }, [onConversationCreated]);
|
|
85
|
+
return createElement(AgentConversationComponent, {
|
|
86
|
+
...props,
|
|
87
|
+
// omitted rather than `undefined` while no conversation is named or created yet
|
|
88
|
+
...(conversationId !== undefined ? { conversationId } : {}),
|
|
89
|
+
onNavigateConversation: navigate,
|
|
90
|
+
onConversationCreated: created,
|
|
91
|
+
});
|
|
92
|
+
}
|
|
66
93
|
/**
|
|
67
94
|
* The conversation this panel opens when the host does not name one.
|
|
68
95
|
*
|
|
@@ -123,7 +150,7 @@ export function createXenoAgentInterfacePanel(options) {
|
|
|
123
150
|
}
|
|
124
151
|
restoreBridge = configureAgentPlatformBridge(bridge);
|
|
125
152
|
root = createRoot(el);
|
|
126
|
-
root.render(createElement(
|
|
153
|
+
root.render(createElement(PanelConversation, {
|
|
127
154
|
...defaultConversationProps(),
|
|
128
155
|
...options.conversation,
|
|
129
156
|
}));
|
|
@@ -144,7 +171,7 @@ export function createXenoAgentInterfacePanel(options) {
|
|
|
144
171
|
* boundary can end up with two Reacts, and every hook throws "Invalid hook call".
|
|
145
172
|
*/
|
|
146
173
|
root = createRoot(container);
|
|
147
|
-
root.render(createElement(
|
|
174
|
+
root.render(createElement(PanelConversation, {
|
|
148
175
|
...defaultConversationProps(),
|
|
149
176
|
...options.conversation,
|
|
150
177
|
}));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources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b,CAAC;yBACF;qBACF,CAAC,CAAA;oBACF,IAAI,QAAQ,EAAE,CAAC;wBACb,MAAM,OAAO,CAAC,OAAO,EAAE,CAAA;wBACvB,OAAM;oBACR,CAAC;oBACD,MAAM,GAAG,OAAO,CAAA;gBAClB,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAA;gBAC1B,CAAC;YACH,CAAC,CAAC,EAAE,CAAA;YAEJ,OAAO,GAAG,EAAE;gBACV,QAAQ,GAAG,IAAI,CAAA;gBACf,KAAK,MAAM,EAAE,OAAO,EAAE,CAAA;gBACtB,MAAM,GAAG,IAAI,CAAA;gBACb,IAAI,EAAE,OAAO,EAAE,CAAA;gBACf,IAAI,GAAG,IAAI,CAAA;gBACX,aAAa,EAAE,EAAE,CAAA;gBACjB,aAAa,GAAG,IAAI,CAAA;YACtB,CAAC,CAAA;QACH,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xenosystem/agent-interface-panel",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.37",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@xenosystem/panel-agent": "^0.1.0",
|
|
27
|
-
"@xenosystem/agent-interface-
|
|
28
|
-
"@xenosystem/agent-
|
|
29
|
-
"@xenosystem/agent-
|
|
30
|
-
"@xenosystem/agent-interface-
|
|
27
|
+
"@xenosystem/agent-interface-contract": "0.1.37",
|
|
28
|
+
"@xenosystem/agent-interface-client": "0.1.37",
|
|
29
|
+
"@xenosystem/agent-conversation": "0.1.37",
|
|
30
|
+
"@xenosystem/agent-interface-embed": "0.1.37"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@xenosystem/panel-sdk": "^1.1.0",
|