loopengine 0.3.80 → 0.3.81

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.
@@ -37,6 +37,7 @@ export const consoleSidebarHtml = `<aside class="le-sidebar" aria-label="Console
37
37
  <div class="le-nav-label"><a class="le-nav-head" href="/goals" data-le-nav-head="goals">${GOALS_ICON}Goals</a><a href="/goals?new=1" data-le-goal-new>+ New</a></div>
38
38
  <ul class="le-agent-list le-goal-list" id="leGoalList"></ul>
39
39
  <div class="le-nav-label"><a class="le-nav-head" href="/jobs" data-le-nav-head="jobs">${JOBS_ICON}Jobs</a><a href="/jobs?new=1" data-le-job-new>+ New</a></div>
40
+ <ul class="le-agent-list le-goal-list" id="leJobList"></ul>
40
41
  <div class="le-nav-label"><a class="le-nav-head" href="/agents" data-le-nav-head="agents">${AGENTS_ICON}Agents</a><a href="/agents?new=1">+ New</a></div>
41
42
  <ul class="le-agent-list" id="leAgentList"></ul>
42
43
  <a class="le-find" href="/interview" data-le-nav="interview">Find your first agent</a>
@@ -145,8 +146,6 @@ export const consoleShellScript = `<script>
145
146
  var creating = page === 'goals' && !onJobs && !current && (location.pathname === '/' || new URLSearchParams(location.search).has('new'));
146
147
  var head = document.querySelector('[data-le-nav-head="goals"]');
147
148
  if (head) { if (page === 'goals' && !onJobs && !current && !creating) head.setAttribute('aria-current', 'page'); else head.removeAttribute('aria-current'); }
148
- var jobsHead = document.querySelector('[data-le-nav-head="jobs"]');
149
- if (jobsHead) { if (onJobs) jobsHead.setAttribute('aria-current', 'page'); else jobsHead.removeAttribute('aria-current'); }
150
149
  if (newLink) { if (creating) newLink.setAttribute('aria-current', 'page'); else newLink.removeAttribute('aria-current'); }
151
150
  goalList.innerHTML = goals.length ? goals.map(function (g) {
152
151
  return '<li><a class="le-agent-item le-goal-item" href="/goals?goal=' + enc(g.id) + '" title="' + esc(g.goal) + '"' + (g.id === current ? ' aria-current="page"' : '') + '>' +
@@ -157,6 +156,35 @@ export const consoleShellScript = `<script>
157
156
  }
158
157
  reloadGoals();
159
158
 
159
+ // ---- Jobs, listed under Goals: the person's own jobs (GET /jobs), newest
160
+ // added first, each opening on the Jobs page; its dot says whether it's
161
+ // running, waiting for them, or not started. The Jobs page reloads the
162
+ // list when it changes (leShell.reloadJobs).
163
+ var jobList = document.getElementById('leJobList');
164
+ function reloadJobs() {
165
+ if (!jobList) return Promise.resolve();
166
+ var onJobs = location.pathname === '/jobs';
167
+ var current = onJobs ? new URLSearchParams(location.search).get('job') : null;
168
+ var jobsHead = document.querySelector('[data-le-nav-head="jobs"]');
169
+ if (jobsHead) { if (onJobs && !current) jobsHead.setAttribute('aria-current', 'page'); else jobsHead.removeAttribute('aria-current'); }
170
+ return fetch('/jobs', { headers: { accept: 'application/json' } })
171
+ .then(function (r) { return r.ok ? r.json() : { jobs: [] }; })
172
+ .then(function (data) {
173
+ var jobs = data.jobs || [];
174
+ jobList.innerHTML = jobs.length ? jobs.map(function (x) {
175
+ var j = x.job;
176
+ var t = j.tries && j.tries.length ? j.tries[j.tries.length - 1] : null;
177
+ var dot = t && (t.status === 'awaiting_approval' || t.status === 'done') && j.state === 'active' ? ' warn'
178
+ : j.state === 'active' ? '' : ' idle';
179
+ var label = j.state === 'done' ? 'Done' : j.state === 'active' ? (dot === ' warn' ? 'Needs you' : 'Running') : 'Not started';
180
+ return '<li><a class="le-agent-item le-goal-item" href="/jobs?job=' + enc(j.id) + '" title="' + esc(j.title) + ' (' + label + ')"' + (j.id === current ? ' aria-current="page"' : '') + '>' +
181
+ '<span class="le-dot' + dot + '" aria-hidden="true"></span><span class="le-name">' + esc(j.title) + '</span></a></li>';
182
+ }).join('') : '<li class="le-agent-item"><span></span><span class="le-meta">No jobs yet</span><span></span></li>';
183
+ })
184
+ .catch(function () { jobList.innerHTML = ''; });
185
+ }
186
+ reloadJobs();
187
+
160
188
  var loadError = null;
161
189
  var ready = fetch('/agents', { headers: { accept: 'application/json' } })
162
190
  .then(function (r) {
@@ -500,6 +528,6 @@ export const consoleShellScript = `<script>
500
528
  }
501
529
 
502
530
 
503
- window.leShell = { loadError: function () { return loadError; }, ready: ready, reloadGoals: reloadGoals, renderHead: renderHead, setTab: setTab, setActive: setActive, setDisplayName: setDisplayName, displayNameOf: displayNameOf, esc: esc, tabHref: tabHref, envCountHtml: envCountHtml, setCount: setCount, wireModelPicker: wireModelPicker, loadProviderKeys: loadProviderKeys, applyProviderKeys: applyProviderKeys, abilityOriginBadge: abilityOriginBadge, toggleAbilityDetails: toggleAbilityDetails };
531
+ window.leShell = { loadError: function () { return loadError; }, ready: ready, reloadGoals: reloadGoals, reloadJobs: reloadJobs, renderHead: renderHead, setTab: setTab, setActive: setActive, setDisplayName: setDisplayName, displayNameOf: displayNameOf, esc: esc, tabHref: tabHref, envCountHtml: envCountHtml, setCount: setCount, wireModelPicker: wireModelPicker, loadProviderKeys: loadProviderKeys, applyProviderKeys: applyProviderKeys, abilityOriginBadge: abilityOriginBadge, toggleAbilityDetails: toggleAbilityDetails };
504
532
  })();
505
533
  </script>`;
@@ -148,6 +148,7 @@ export const devUiCss = `
148
148
  .le-agent-item .le-meta { font-size: 12px; color: var(--ink-faint); }
149
149
  .le-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
150
150
  .le-dot.warn { background: var(--warn); }
151
+ .le-dot.idle { background: var(--ink-faint); }
151
152
  .le-foot { border-top: 1px solid var(--line); padding: 8px; display: grid; gap: 2px; }
152
153
  .le-foot a { padding: 7px 8px; border-radius: 6px; color: var(--ink-muted); text-decoration: none; }
153
154
  .le-foot a:hover { background: var(--surface-2); color: var(--ink); }
@@ -202,10 +202,16 @@ ${consoleShellScript}
202
202
  function loadJobs() {
203
203
  api('GET', '/jobs').then(function (r) {
204
204
  if (!r.ok) { page.innerHTML = '<p class="error">Could not load jobs: ' + esc(r.body.error || 'unknown error') + '</p>'; return; }
205
+ var first = !state.jobsLoaded;
205
206
  state.jobs = r.body.jobs || [];
206
207
  state.jobsLoaded = true;
207
208
  state.jobsStale = false;
209
+ // A job picked in the sidebar (?job=): open, and brought into view.
210
+ var picked = first ? new URLSearchParams(location.search).get('job') : null;
211
+ if (picked) state.openJobs[picked] = true;
212
+ if (!first) reloadSidebar();
208
213
  render();
214
+ if (picked) { var el = page.querySelector('.gl-job[data-wf="' + picked.replace(/[^a-z0-9-]/gi, '') + '"]'); if (el) el.scrollIntoView({ block: 'center' }); }
209
215
  });
210
216
  }
211
217
 
@@ -257,6 +263,7 @@ ${consoleShellScript}
257
263
  }
258
264
  function reloadSidebar() {
259
265
  if (window.leShell && window.leShell.reloadGoals) window.leShell.reloadGoals();
266
+ if (window.leShell && window.leShell.reloadJobs) window.leShell.reloadJobs();
260
267
  }
261
268
  function replaceGoal(goal) {
262
269
  // On the Jobs page, a job's goal coming back means the list changed.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loopengine",
3
- "version": "0.3.80",
3
+ "version": "0.3.81",
4
4
  "type": "module",
5
5
  "description": "Runtime for tool-using AI agents with a transparent ReAct loop.",
6
6
  "license": "MIT",