@leeoohoo/ui-apps-devkit 0.1.3 → 0.1.5
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/bin/chatos-uiapp.js +1 -1
- package/package.json +1 -1
- package/src/lib/args.js +16 -2
- package/src/sandbox/server.js +30 -2
package/bin/chatos-uiapp.js
CHANGED
package/package.json
CHANGED
package/src/lib/args.js
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
export function parseArgs(argv) {
|
|
2
|
-
const
|
|
2
|
+
const rawArgs = Array.isArray(argv) ? argv.slice() : [];
|
|
3
|
+
const head = rawArgs[0] || '';
|
|
4
|
+
const second = rawArgs[1] || '';
|
|
5
|
+
const hasRuntimePrefix =
|
|
6
|
+
head.endsWith('node') ||
|
|
7
|
+
head.endsWith('node.exe') ||
|
|
8
|
+
head.includes('/node') ||
|
|
9
|
+
head.includes('\\node') ||
|
|
10
|
+
head.endsWith('bun') ||
|
|
11
|
+
head.endsWith('bun.exe') ||
|
|
12
|
+
head.includes('/bun') ||
|
|
13
|
+
head.includes('\\bun') ||
|
|
14
|
+
second.endsWith('.js') ||
|
|
15
|
+
second.endsWith('.mjs') ||
|
|
16
|
+
second.endsWith('.cjs');
|
|
17
|
+
const raw = hasRuntimePrefix ? rawArgs.slice(2) : rawArgs;
|
|
3
18
|
const flags = {};
|
|
4
19
|
const positionals = [];
|
|
5
20
|
|
|
@@ -46,4 +61,3 @@ export function parseArgs(argv) {
|
|
|
46
61
|
|
|
47
62
|
return { positionals, flags };
|
|
48
63
|
}
|
|
49
|
-
|
package/src/sandbox/server.js
CHANGED
|
@@ -739,6 +739,16 @@ function htmlPage() {
|
|
|
739
739
|
box-shadow: 0 14px 40px rgba(0,0,0,0.16);
|
|
740
740
|
z-index: 12;
|
|
741
741
|
}
|
|
742
|
+
#mcpPanel[data-mode='half'] {
|
|
743
|
+
right: 0;
|
|
744
|
+
top: 72px;
|
|
745
|
+
width: 50vw;
|
|
746
|
+
height: calc(100vh - 84px);
|
|
747
|
+
max-height: none;
|
|
748
|
+
border-right: none;
|
|
749
|
+
border-top-right-radius: 0;
|
|
750
|
+
border-bottom-right-radius: 0;
|
|
751
|
+
}
|
|
742
752
|
#mcpPanelHeader {
|
|
743
753
|
padding: 10px 12px;
|
|
744
754
|
display:flex;
|
|
@@ -795,6 +805,7 @@ function htmlPage() {
|
|
|
795
805
|
<div id="sandboxContext" class="muted"></div>
|
|
796
806
|
<button id="btnLlmConfig" class="btn" type="button">AI Config</button>
|
|
797
807
|
<button id="btnMcpTest" class="btn" type="button">MCP Test</button>
|
|
808
|
+
<button id="btnMcpHalf" class="btn" type="button">Half Test</button>
|
|
798
809
|
<button id="btnInspectorToggle" class="btn" type="button">Inspect</button>
|
|
799
810
|
<button id="btnReload" class="btn" type="button">Reload</button>
|
|
800
811
|
</div>
|
|
@@ -950,6 +961,7 @@ const llmModelId = $('#llmModelId');
|
|
|
950
961
|
const llmStatus = $('#llmStatus');
|
|
951
962
|
const llmKeyStatus = $('#llmKeyStatus');
|
|
952
963
|
const btnMcpTest = $('#btnMcpTest');
|
|
964
|
+
const btnMcpHalf = $('#btnMcpHalf');
|
|
953
965
|
const mcpPanel = $('#mcpPanel');
|
|
954
966
|
const btnMcpClose = $('#btnMcpClose');
|
|
955
967
|
const btnMcpClear = $('#btnMcpClear');
|
|
@@ -1128,8 +1140,13 @@ const refreshMcpConfigHint = async () => {
|
|
|
1128
1140
|
}
|
|
1129
1141
|
};
|
|
1130
1142
|
|
|
1131
|
-
const setMcpPanelOpen = (open) => {
|
|
1143
|
+
const setMcpPanelOpen = (open, mode) => {
|
|
1132
1144
|
if (!mcpPanel) return;
|
|
1145
|
+
if (mode) {
|
|
1146
|
+
mcpPanel.dataset.mode = mode;
|
|
1147
|
+
} else {
|
|
1148
|
+
delete mcpPanel.dataset.mode;
|
|
1149
|
+
}
|
|
1133
1150
|
mcpPanel.style.display = open ? 'flex' : 'none';
|
|
1134
1151
|
mcpPanel.setAttribute('aria-hidden', open ? 'false' : 'true');
|
|
1135
1152
|
if (open) {
|
|
@@ -1138,6 +1155,16 @@ const setMcpPanelOpen = (open) => {
|
|
|
1138
1155
|
}
|
|
1139
1156
|
};
|
|
1140
1157
|
|
|
1158
|
+
const toggleMcpPanel = (mode) => {
|
|
1159
|
+
if (!mcpPanel) return;
|
|
1160
|
+
const currentMode = mcpPanel.dataset.mode || 'panel';
|
|
1161
|
+
if (isMcpPanelOpen() && currentMode === mode) {
|
|
1162
|
+
setMcpPanelOpen(false);
|
|
1163
|
+
return;
|
|
1164
|
+
}
|
|
1165
|
+
setMcpPanelOpen(true, mode);
|
|
1166
|
+
};
|
|
1167
|
+
|
|
1141
1168
|
const runMcpTest = async () => {
|
|
1142
1169
|
const sendBtn = btnMcpSend;
|
|
1143
1170
|
try {
|
|
@@ -1278,7 +1305,8 @@ if (btnLlmClose) btnLlmClose.addEventListener('click', () => setLlmPanelOpen(fal
|
|
|
1278
1305
|
if (btnLlmRefresh) btnLlmRefresh.addEventListener('click', () => refreshLlmConfig());
|
|
1279
1306
|
if (btnLlmSave) btnLlmSave.addEventListener('click', () => saveLlmConfig());
|
|
1280
1307
|
if (btnLlmClear) btnLlmClear.addEventListener('click', () => saveLlmConfig({ clearKey: true }));
|
|
1281
|
-
if (btnMcpTest) btnMcpTest.addEventListener('click', () =>
|
|
1308
|
+
if (btnMcpTest) btnMcpTest.addEventListener('click', () => toggleMcpPanel('panel'));
|
|
1309
|
+
if (btnMcpHalf) btnMcpHalf.addEventListener('click', () => toggleMcpPanel('half'));
|
|
1282
1310
|
if (btnMcpClose) btnMcpClose.addEventListener('click', () => setMcpPanelOpen(false));
|
|
1283
1311
|
if (btnMcpClear)
|
|
1284
1312
|
btnMcpClear.addEventListener('click', () => {
|