loopengine 0.5.6 → 0.5.7

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.
@@ -848,6 +848,41 @@ ${consoleSidebarHtml}
848
848
  </div>
849
849
  ${consoleShellScript}
850
850
  <script>
851
+ (function () {
852
+ // Every request this page's address already settles (the agent's
853
+ // config, messaging, pending decisions, schedules and workflows, and on
854
+ // a workflow's page its versions, health, eval candidates and runs)
855
+ // starts now, together, instead of each waiting for the one before it:
856
+ // on a hosted workspace every round trip costs hundreds of
857
+ // milliseconds, and the chain was four of them deep. The page's own
858
+ // request for one of these URLs then gets the response already on its
859
+ // way; each is used once, so a later reload of it fetches fresh.
860
+ var plainFetch = window.fetch.bind(window);
861
+ var early = {};
862
+ (function () {
863
+ var q = new URLSearchParams(location.search);
864
+ var agent = q.get('agent');
865
+ if (location.pathname !== '/agents/config' || !agent) return;
866
+ var base = '/agents/' + encodeURIComponent(agent);
867
+ var urls = [base + '/config', base + '/notifier', base + '/pending', base + '/schedules', base + '/workflows'];
868
+ var wf = q.get('tab') === 'workflows' && q.get('workflow');
869
+ if (wf) {
870
+ var b = base + '/workflows/' + encodeURIComponent(wf);
871
+ urls.push(b + '/versions', b + '/health', b + '/evals/candidates', b + '/runs');
872
+ }
873
+ urls.forEach(function (u) { early[u] = plainFetch(u, { headers: { accept: 'application/json' } }); });
874
+ })();
875
+ window.fetch = function (input, init) {
876
+ var url = typeof input === 'string' ? input : '';
877
+ var method = String((init && init.method) || 'GET').toUpperCase();
878
+ if (method === 'GET' && Object.prototype.hasOwnProperty.call(early, url)) {
879
+ var pending = early[url];
880
+ delete early[url];
881
+ return pending.catch(function () { return plainFetch(input, init); });
882
+ }
883
+ return plainFetch(input, init);
884
+ };
885
+ })();
851
886
  (function () {
852
887
  // The providers whose models take a reasoning effort (web/agent-file-admin.ts).
853
888
  var REASONING_PROVIDERS = ${JSON.stringify(REASONING_PROVIDERS)};
@@ -159,6 +159,10 @@ ${renderMarkdownScript}
159
159
  var state = { view: VIEWS.some(function (v) { return v[0] === asked; }) ? asked : '', q: params.get('q') || '', workflow: params.get('workflow') || '', item: params.get('item') || '' };
160
160
  var listed = null;
161
161
  var openThread = null;
162
+ // The conversation the address opens on (?item=) is asked for now,
163
+ // alongside the list, not after it: on a hosted workspace that saves a
164
+ // round trip of hundreds of milliseconds. Used once.
165
+ var earlyThread = state.item ? { id: state.item, response: fetch('/inbox/cases/' + encodeURIComponent(state.item), { headers: { accept: 'application/json' } }) } : null;
162
166
  var fullAccess = !document.querySelector('.le-app.le-inbox-only');
163
167
  var role = 'owner';
164
168
  var workflows = {};
@@ -332,7 +336,9 @@ ${renderMarkdownScript}
332
336
  function loadThread(id) {
333
337
  var box = page.querySelector('.ib-thread');
334
338
  if (!openThread || openThread.id !== id) box.innerHTML = '<div class="ib-thread-empty">Loading' + ELLIPSIS + '</div>';
335
- return fetch('/inbox/cases/' + encodeURIComponent(id), { headers: { accept: 'application/json' } })
339
+ var early = earlyThread && earlyThread.id === id ? earlyThread.response : null;
340
+ earlyThread = null;
341
+ return (early || fetch('/inbox/cases/' + encodeURIComponent(id), { headers: { accept: 'application/json' } }))
336
342
  .then(function (r) { return r.ok ? r.json() : r.json().then(function (b) { throw new Error(b.error || 'HTTP ' + r.status); }); })
337
343
  .then(function (c) {
338
344
  if (state.item !== id) return;
@@ -573,10 +579,17 @@ ${renderMarkdownScript}
573
579
  }, 15000);
574
580
  }
575
581
 
582
+ // The list doesn't wait for the person's role: only whether they can
583
+ // decide depends on it, so a conversation already open is drawn again
584
+ // if they turn out not to.
585
+ start();
576
586
  (window.leShell && window.leShell.settings ? window.leShell.settings() : fetch('/config/settings').then(function (r) { return r.ok ? r.json() : null; }))
577
- .then(function (s) { if (s && s.signIn && s.signIn.role) role = s.signIn.role; })
578
- .catch(function () {})
579
- .then(start);
587
+ .then(function (s) {
588
+ var was = role;
589
+ if (s && s.signIn && s.signIn.role) role = s.signIn.role;
590
+ if (role !== was && state.item && openThread) { openThread = null; loadThread(state.item); }
591
+ })
592
+ .catch(function () {});
580
593
  })();
581
594
  </script>
582
595
  </body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loopengine",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "type": "module",
5
5
  "description": "Runtime for tool-using AI agents with a transparent ReAct loop.",
6
6
  "license": "MIT",