@leeoohoo/ui-apps-devkit 0.1.10 → 0.1.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leeoohoo/ui-apps-devkit",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "ChatOS UI Apps DevKit (CLI + templates + sandbox) for building installable ChatOS UI Apps plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1013,6 +1013,42 @@ const mcpStatus = $('#mcpStatus');
1013
1013
  const mcpOutput = $('#mcpOutput');
1014
1014
  const mcpConfigHint = $('#mcpConfigHint');
1015
1015
 
1016
+ const mcpStreamState = {
1017
+ active: false,
1018
+ seen: false,
1019
+ runId: '',
1020
+ };
1021
+
1022
+ const resetMcpStreamState = () => {
1023
+ mcpStreamState.active = false;
1024
+ mcpStreamState.seen = false;
1025
+ mcpStreamState.runId = '';
1026
+ };
1027
+
1028
+ const markMcpStreamStatus = (payload) => {
1029
+ const method = payload && typeof payload.method === 'string' ? payload.method : '';
1030
+ if (!method.startsWith('codex_app.window_run.')) return;
1031
+ const params = payload && typeof payload.params === 'object' ? payload.params : null;
1032
+ const runId = params && typeof params.runId === 'string' ? params.runId : '';
1033
+ if (runId && (!mcpStreamState.runId || mcpStreamState.runId === runId)) {
1034
+ mcpStreamState.runId = runId;
1035
+ }
1036
+ mcpStreamState.seen = true;
1037
+ const status = params && typeof params.status === 'string' ? params.status.toLowerCase() : '';
1038
+ const done =
1039
+ method === 'codex_app.window_run.done' ||
1040
+ method === 'codex_app.window_run.completed' ||
1041
+ params?.done === true ||
1042
+ ['completed', 'failed', 'aborted', 'cancelled'].includes(status);
1043
+ if (done) {
1044
+ mcpStreamState.active = false;
1045
+ setMcpStatus('Done');
1046
+ } else {
1047
+ mcpStreamState.active = true;
1048
+ setMcpStatus('Streaming...');
1049
+ }
1050
+ };
1051
+
1016
1052
  const setPanelOpen = (open) => { panel.style.display = open ? 'flex' : 'none'; };
1017
1053
  fab.addEventListener('click', () => setPanelOpen(panel.style.display !== 'flex'));
1018
1054
  panelClose.addEventListener('click', () => setPanelOpen(false));
@@ -1229,6 +1265,7 @@ const runMcpTest = async () => {
1229
1265
  setMcpStatus('Message is required.', true);
1230
1266
  return;
1231
1267
  }
1268
+ resetMcpStreamState();
1232
1269
  if (sendBtn) sendBtn.disabled = true;
1233
1270
  const payload = {
1234
1271
  messages: [{ role: 'user', text: message }],
@@ -1255,7 +1292,11 @@ const runMcpTest = async () => {
1255
1292
  if (Array.isArray(j?.toolTrace) && j.toolTrace.length > 0) {
1256
1293
  appendMcpOutput('toolTrace', j.toolTrace);
1257
1294
  }
1258
- setMcpStatus('Done');
1295
+ if (mcpStreamState.seen || mcpStreamState.active) {
1296
+ setMcpStatus('Waiting for MCP stream...');
1297
+ } else {
1298
+ setMcpStatus('Done');
1299
+ }
1259
1300
  } catch (err) {
1260
1301
  setMcpStatus(err?.message || String(err), true);
1261
1302
  } finally {
@@ -1964,6 +2005,7 @@ try {
1964
2005
  if (!payload) return;
1965
2006
  const server = payload?.serverName ? String(payload.serverName) : 'mcp';
1966
2007
  const method = payload?.method ? String(payload.method) : 'notification';
2008
+ markMcpStreamStatus(payload);
1967
2009
  appendMcpOutput(server + ' ' + method, payload?.params?.text || payload);
1968
2010
  });
1969
2011
  } catch {