@lelouchhe/webagent 0.1.3 → 0.1.4

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.html CHANGED
@@ -13,7 +13,7 @@
13
13
  <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
14
14
  <script src="https://cdn.jsdelivr.net/npm/dompurify@3.3.2/dist/purify.min.js"></script>
15
15
  <script>document.documentElement.setAttribute('data-theme', localStorage.getItem('theme') || 'auto');</script>
16
- <link rel="stylesheet" href="/styles.mmjvjb37.css">
16
+ <link rel="stylesheet" href="/styles.mmk25uhc.css">
17
17
  </head>
18
18
  <body>
19
19
 
@@ -41,6 +41,6 @@
41
41
  <input type="file" id="file-input" accept="image/*" multiple hidden>
42
42
  </div>
43
43
 
44
- <script type="module" src="/js/app.mmjvjb37.js"></script>
44
+ <script type="module" src="/js/app.mmk25uhc.js"></script>
45
45
  </body>
46
46
  </html>
@@ -0,0 +1,10 @@
1
+ // Boot entry point — imports all modules and starts the app
2
+
3
+ import './render.mmk25uhc.js'; // theme, click-to-collapse listeners
4
+ import './commands.mmk25uhc.js'; // slash menu listeners
5
+ import './images.mmk25uhc.js'; // attach/paste listeners
6
+ import './input.mmk25uhc.js'; // keyboard/send listeners
7
+ import { connect } from './connection.mmk25uhc.js';
8
+
9
+ connect();
10
+ if ('serviceWorker' in navigator) navigator.serviceWorker.register('/sw.js');
@@ -4,9 +4,9 @@ import {
4
4
  state, dom, setBusy, resetSessionUI, requestNewSession, sendCancel,
5
5
  getConfigOption, getConfigValue, setHashSessionId, updateSessionInfo,
6
6
  updateNewBtnVisibility,
7
- } from './state.mmjvjb37.js';
8
- import { addSystem, addMessage, scrollToBottom, escHtml, formatLocalTime } from './render.mmjvjb37.js';
9
- import { loadHistory } from './events.mmjvjb37.js';
7
+ } from './state.mmk25uhc.js';
8
+ import { addSystem, addMessage, scrollToBottom, escHtml, formatLocalTime } from './render.mmk25uhc.js';
9
+ import { loadHistory } from './events.mmk25uhc.js';
10
10
 
11
11
  // --- Slash command execution ---
12
12
 
@@ -1,8 +1,8 @@
1
1
  // WebSocket connection lifecycle
2
2
 
3
- import { state, setBusy, getHashSessionId, requestNewSession, resetSessionUI, setConnectionStatus, clearCancelTimer } from './state.mmjvjb37.js';
4
- import { addSystem, finishThinking, finishAssistant, finishBash, scrollToBottom } from './render.mmjvjb37.js';
5
- import { handleEvent, loadHistory, loadNewEvents } from './events.mmjvjb37.js';
3
+ import { state, setBusy, getHashSessionId, requestNewSession, resetSessionUI, setConnectionStatus, clearCancelTimer } from './state.mmk25uhc.js';
4
+ import { addSystem, finishThinking, finishAssistant, finishBash, scrollToBottom } from './render.mmk25uhc.js';
5
+ import { handleEvent, loadHistory, loadNewEvents } from './events.mmk25uhc.js';
6
6
 
7
7
  export function connect() {
8
8
  const proto = location.protocol === 'https:' ? 'wss:' : 'ws:';
@@ -15,7 +15,7 @@ export function connect() {
15
15
  const existingId = getHashSessionId();
16
16
 
17
17
  // Incremental reconnect: same session still in memory — skip DOM wipe
18
- if (existingId && existingId === state.sessionId) {
18
+ if (existingId && existingId === state.sessionId && state.lastEventSeq > 0) {
19
19
  await loadNewEvents(existingId);
20
20
  scrollToBottom(false);
21
21
  state.ws.send(JSON.stringify({ type: 'resume_session', sessionId: existingId }));
@@ -4,12 +4,12 @@ import {
4
4
  state, dom, setBusy, setConfigValue, getConfigOption, updateConfigOptions,
5
5
  updateModeUI, resetSessionUI, requestNewSession, setHashSessionId, updateSessionInfo,
6
6
  setConnectionStatus, clearCancelTimer,
7
- } from './state.mmjvjb37.js';
7
+ } from './state.mmk25uhc.js';
8
8
  import {
9
9
  addMessage, addSystem, finishAssistant, finishThinking, hideWaiting,
10
10
  scrollToBottom, renderMd, escHtml, renderPatchDiff, addBashBlock, finishBash, appendMessageElement,
11
11
  formatLocalTime,
12
- } from './render.mmjvjb37.js';
12
+ } from './render.mmk25uhc.js';
13
13
 
14
14
  function finishPromptIfIdle() {
15
15
  if (!state.pendingPromptDone) return;
@@ -32,7 +32,7 @@ function cancelPendingTurnUI() {
32
32
  }
33
33
  for (const requestId of state.pendingPermissionRequestIds) {
34
34
  const permEl = document.querySelector(`.permission[data-request-id="${requestId}"]`);
35
- if (!permEl) continue;
35
+ if (!permEl || !permEl.querySelector('button')) continue;
36
36
  const titleEl = permEl.querySelector('.title');
37
37
  const title = titleEl?.textContent || '⚿';
38
38
  permEl.innerHTML = `<span style="opacity:0.5">${escHtml(title)} — cancelled</span>`;
@@ -236,7 +236,7 @@ export function replayEvent(type, data, events, idx) {
236
236
  const el = document.querySelector(`.permission[data-request-id="${data.requestId}"]`);
237
237
  if (el) {
238
238
  const title = el.dataset.title ? `⚿ ${el.dataset.title}` : '⚿';
239
- const action = data.denied ? 'denied' : data.optionName || 'allowed';
239
+ const action = data.optionName || (data.denied ? 'denied' : 'allowed');
240
240
  el.innerHTML = `<span style="opacity:0.5">${escHtml(title)} — ${escHtml(action)}</span>`;
241
241
  }
242
242
  break;
@@ -508,7 +508,7 @@ export function handleEvent(msg) {
508
508
  const permTarget = document.querySelector(`.permission[data-request-id="${msg.requestId}"]`);
509
509
  if (msg.sessionId === state.sessionId && permTarget) {
510
510
  const title = permTarget.dataset.title ? `⚿ ${permTarget.dataset.title}` : '⚿';
511
- const action = msg.denied ? 'denied' : msg.optionName || 'allowed';
511
+ const action = msg.optionName || (msg.denied ? 'denied' : 'allowed');
512
512
  permTarget.innerHTML = `<span style="opacity:0.5">${escHtml(title)} — ${escHtml(action)}</span>`;
513
513
  }
514
514
  finishPromptIfIdle();
@@ -1,6 +1,6 @@
1
1
  // Image attach, preview, and paste handling
2
2
 
3
- import { state, dom } from './state.mmjvjb37.js';
3
+ import { state, dom } from './state.mmk25uhc.js';
4
4
 
5
5
  function readFileAsBase64(file) {
6
6
  return new Promise((resolve) => {
@@ -3,10 +3,10 @@
3
3
  import {
4
4
  state, dom, setBusy, sendCancel,
5
5
  getConfigOption, getConfigValue, updateNewBtnVisibility,
6
- } from './state.mmjvjb37.js';
7
- import { addMessage, addSystem, addBashBlock, showWaiting } from './render.mmjvjb37.js';
8
- import { handleSlashCommand, hideSlashMenu, handleSlashMenuKey, updateSlashMenu } from './commands.mmjvjb37.js';
9
- import { renderAttachPreview } from './images.mmjvjb37.js';
6
+ } from './state.mmk25uhc.js';
7
+ import { addMessage, addSystem, addBashBlock, showWaiting } from './render.mmk25uhc.js';
8
+ import { handleSlashCommand, hideSlashMenu, handleSlashMenuKey, updateSlashMenu } from './commands.mmk25uhc.js';
9
+ import { renderAttachPreview } from './images.mmk25uhc.js';
10
10
 
11
11
  // Wire up cancel-timeout feedback (state.js cannot import render.js directly)
12
12
  state._onCancelTimeout = () => addSystem('warn: Agent not responding to cancel');
@@ -1,6 +1,6 @@
1
1
  // Rendering functions, theme, markdown, bash UI
2
2
 
3
- import { dom, state } from './state.mmjvjb37.js';
3
+ import { dom, state } from './state.mmk25uhc.js';
4
4
 
5
5
  // --- Markdown ---
6
6
  marked.setOptions({ breaks: true, gfm: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lelouchhe/webagent",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "A terminal-style web UI for ACP-compatible agents",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,10 +0,0 @@
1
- // Boot entry point — imports all modules and starts the app
2
-
3
- import './render.mmjvjb37.js'; // theme, click-to-collapse listeners
4
- import './commands.mmjvjb37.js'; // slash menu listeners
5
- import './images.mmjvjb37.js'; // attach/paste listeners
6
- import './input.mmjvjb37.js'; // keyboard/send listeners
7
- import { connect } from './connection.mmjvjb37.js';
8
-
9
- connect();
10
- if ('serviceWorker' in navigator) navigator.serviceWorker.register('/sw.js');