@floless/app 0.150.0 → 0.151.0
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/floless-server.cjs +7467 -5068
- package/dist/skills/floless-app-onboarding/SKILL.md +200 -87
- package/dist/skills/floless-app-onboarding/references/aware-runtime.md +27 -18
- package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +207 -0
- package/dist/web/agents.js +108 -12
- package/dist/web/app.css +98 -20
- package/dist/web/app.js +14 -107
- package/dist/web/aware.js +459 -59
- package/dist/web/chat.css +12 -0
- package/dist/web/chat.js +95 -18
- package/dist/web/commands-shell.js +198 -10
- package/dist/web/guide.js +675 -0
- package/dist/web/index.html +64 -4
- package/dist/web/instructor.js +8 -2
- package/dist/web/tool-updates.js +175 -9
- package/dist/web/workspaces.js +217 -64
- package/package.json +2 -2
- package/dist/skills/floless-app-onboarding/references/floless-app-tour.md +0 -158
package/dist/web/index.html
CHANGED
|
@@ -191,7 +191,16 @@
|
|
|
191
191
|
<div class="ai-chat-setting ai-chat-provider" id="chat-provider" data-tip="FloLess uses whichever account is signed in to the Claude Code or Codex CLI on this computer. Signing in to the Claude desktop app or claude.ai does not change it. Switch account signs that CLI out first, then opens a window where you sign in."><span>Provider</span><strong aria-live="polite">—</strong><button data-command-id="shell.chat-switch-account" type="button" class="ai-chat-provider-switch" id="chat-switch-account" hidden>Switch account…</button></div>
|
|
192
192
|
<button data-command-id="shell.chat-model" type="button" class="ai-chat-setting" id="chat-model" aria-haspopup="listbox" aria-expanded="false" data-tip="Choose the model for future messages in this conversation."><span>AI model</span><strong>Choose model</strong></button>
|
|
193
193
|
<button data-command-id="shell.chat-effort" type="button" class="ai-chat-setting" id="chat-effort" aria-haspopup="listbox" aria-expanded="false" data-tip="Choose how much reasoning the AI uses for future messages."><span>Effort</span><strong>Medium</strong></button>
|
|
194
|
-
<button data-command-id="shell.chat-permission" type="button" class="ai-chat-setting" id="chat-permission" aria-haspopup="listbox" aria-expanded="false" data-tip="Access controls what the AI may change: Read only, Working folder write, or Full access."><span>Access</span><strong>Read only</strong></button>
|
|
194
|
+
<button data-command-id="shell.chat-permission" type="button" class="ai-chat-setting" id="chat-permission" aria-haspopup="listbox" aria-expanded="false" data-tip="Access controls what the AI may change: Read only, Auto, Working folder write, or Full access."><span>Access</span><strong>Read only</strong></button>
|
|
195
|
+
<!-- #2046: a Guide conversation's Access is a statement, not a picker, and holds the Guide's own privacy controls. -->
|
|
196
|
+
<div class="ai-chat-setting ai-chat-guide-access" id="chat-guide-access" hidden>
|
|
197
|
+
<span>Access</span><strong>Read only</strong>
|
|
198
|
+
<span>The Guide only reads. Use its buttons, or a regular conversation, to change things.</span>
|
|
199
|
+
<div class="ai-chat-guide-actions">
|
|
200
|
+
<button data-command-id="shell.guide-turn-off" type="button" id="chat-guide-off" data-tip="Stops the Guide looking at this computer. This conversation stays; turn it on again from ≡ → Guide.">Turn off the Guide</button>
|
|
201
|
+
<button data-command-id="shell.guide-delete" type="button" id="chat-guide-delete" data-tip="Deletes your Guide conversations in this projects folder. Asks first.">Delete Guide history…</button>
|
|
202
|
+
</div>
|
|
203
|
+
</div>
|
|
195
204
|
<button data-command-id="shell.chat-integrations" type="button" class="ai-chat-setting ai-chat-integration-setting" id="chat-integrations" aria-haspopup="listbox" aria-expanded="false"><span>Connected accounts</span><strong>Choose a connected account</strong></button>
|
|
196
205
|
<!-- #1907 (owner ruling 2026-10-03): the AI's own connectors are off in every new conversation; this turns them on for this one. -->
|
|
197
206
|
<button data-command-id="shell.chat-own-connectors" type="button" class="ai-chat-setting ai-chat-own-connectors" id="chat-own-connectors" role="switch" aria-checked="false"><span>Use my connectors in this chat</span><strong aria-hidden="true">Off</strong></button>
|
|
@@ -675,6 +684,33 @@
|
|
|
675
684
|
workflow prepared by AWARE, and ONE person click that carries their approvals forward. The
|
|
676
685
|
server owns every decision (tool-updates-service.ts); tool-updates.js only renders its view
|
|
677
686
|
and sends the click. -->
|
|
687
|
+
<!-- #2046: the Guide's question — what it reads, the two sharing switches, the AI, and a preview of exactly what would be
|
|
688
|
+
sent. Filled by web/guide.js; the buttons never scroll away. -->
|
|
689
|
+
<div class="modal-backdrop" id="guide-agent-modal" role="dialog" aria-modal="true" aria-labelledby="guide-modal-title" aria-describedby="guide-modal-sub">
|
|
690
|
+
<div class="modal guide-dialog">
|
|
691
|
+
<div class="modal-title" id="guide-modal-title" tabindex="-1">Let the Guide show you around?</div>
|
|
692
|
+
<div class="modal-sub" id="guide-modal-sub"></div>
|
|
693
|
+
<div class="guide-body" id="guide-modal-body"></div>
|
|
694
|
+
<div class="sr-only" id="guide-modal-live" role="status" aria-live="polite"></div>
|
|
695
|
+
<div class="modal-actions">
|
|
696
|
+
<button data-command-id="shell.guide-not-now" id="guide-modal-secondary" type="button">Not now</button>
|
|
697
|
+
<button data-command-id="shell.guide-turn-on" id="guide-modal-primary" type="button" class="primary">Turn on the Guide</button>
|
|
698
|
+
</div>
|
|
699
|
+
<p class="guide-foot" id="guide-modal-foot"></p>
|
|
700
|
+
</div>
|
|
701
|
+
</div>
|
|
702
|
+
|
|
703
|
+
<div class="modal-backdrop" id="guide-delete-modal" role="dialog" aria-modal="true" aria-labelledby="guide-delete-title" aria-describedby="guide-delete-sub">
|
|
704
|
+
<div class="modal">
|
|
705
|
+
<div class="modal-title" id="guide-delete-title">Delete the Guide’s conversation?</div>
|
|
706
|
+
<div class="modal-sub" id="guide-delete-sub">This removes your Guide conversations in this projects folder, for both Claude and Codex, from this computer. Anything already sent to Claude or Codex stays under their own rules, and FloLess can’t take it back. Your other conversations, and whether the Guide is on, are not changed.</div>
|
|
707
|
+
<div class="modal-actions">
|
|
708
|
+
<button data-command-id="shell.dialog-cancel#deleting Guide history" id="guide-delete-cancel" type="button">Cancel</button>
|
|
709
|
+
<button data-command-id="shell.guide-delete-confirm" id="guide-delete-confirm" type="button" class="danger">Delete Guide history</button>
|
|
710
|
+
</div>
|
|
711
|
+
</div>
|
|
712
|
+
</div>
|
|
713
|
+
|
|
678
714
|
<div class="modal-backdrop" id="tool-updates-modal" role="dialog" aria-modal="true"
|
|
679
715
|
aria-labelledby="tool-updates-title" aria-describedby="tool-updates-sub" aria-busy="false">
|
|
680
716
|
<div class="modal tool-updates-dialog" tabindex="-1">
|
|
@@ -794,6 +830,11 @@
|
|
|
794
830
|
<span class="menu-kbd">Ctrl+R</span>
|
|
795
831
|
</button>
|
|
796
832
|
<div class="menu-divider"></div>
|
|
833
|
+
<!-- #2046: the Guide — FloLess's onboarding agent in AI Chat (web/guide.js). -->
|
|
834
|
+
<button class="menu-item" data-action="guide" data-command-id="menu.guide" role="menuitem">
|
|
835
|
+
<span class="menu-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"/><polygon points="16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76"/></svg></span>
|
|
836
|
+
<span class="menu-label">Guide</span>
|
|
837
|
+
</button>
|
|
797
838
|
<button class="menu-item" data-action="report-issue" data-command-id="menu.report-issue" role="menuitem">
|
|
798
839
|
<span class="menu-icon" aria-hidden="true"><svg viewBox="0 0 24 24"><path d="M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z"/><line x1="4" x2="4" y1="22" y2="15"/></svg></span>
|
|
799
840
|
<span class="menu-label">Report an issue</span>
|
|
@@ -1432,7 +1473,7 @@
|
|
|
1432
1473
|
<div class="modal-backdrop" id="routines-modal">
|
|
1433
1474
|
<div class="modal routines">
|
|
1434
1475
|
<div class="modal-title">Routines</div>
|
|
1435
|
-
<div class="modal-sub">Run a workflow automatically — on a schedule, or on a live trigger (e.g. whenever your model changes).
|
|
1476
|
+
<div class="modal-sub">Run a workflow automatically — on a schedule, or on a live trigger (e.g. whenever your model changes) — exactly like clicking ▶ Run workflow. Or start an agent on a schedule: nobody watches that run, so anything that would ask you is declined and listed for you on the Agents page.</div>
|
|
1436
1477
|
<div class="rtn-quota" id="rtn-quota"></div>
|
|
1437
1478
|
<div class="routines-list" id="routines-list"></div>
|
|
1438
1479
|
<div class="modal-actions">
|
|
@@ -1446,15 +1487,33 @@
|
|
|
1446
1487
|
<div class="modal-backdrop" id="routine-edit-modal">
|
|
1447
1488
|
<div class="modal routine-edit">
|
|
1448
1489
|
<div class="modal-title" id="rtn-edit-title">New routine</div>
|
|
1449
|
-
<div class="modal-sub">Pick a workflow and when it should run.</div>
|
|
1490
|
+
<div class="modal-sub" id="rtn-edit-sub">Pick a workflow and when it should run.</div>
|
|
1450
1491
|
<div class="modal-field">
|
|
1451
1492
|
<label for="rtn-name">Name</label>
|
|
1452
1493
|
<input data-command-id="shell.routine-name" id="rtn-name" type="text" placeholder="e.g. Morning BOM export" autocomplete="off">
|
|
1453
1494
|
</div>
|
|
1454
|
-
|
|
1495
|
+
<!-- #2035: a routine runs a workflow or starts an agent (with nobody watching). Fixed after create. -->
|
|
1496
|
+
<div class="modal-field" id="rtn-target-field">
|
|
1497
|
+
<label>What it runs</label>
|
|
1498
|
+
<div class="rtn-mode" role="group" aria-label="What the routine runs">
|
|
1499
|
+
<button data-command-id="shell.routine-target#a workflow" type="button" class="rtn-mode-btn active" data-target="workflow" aria-pressed="true">A workflow</button>
|
|
1500
|
+
<button data-command-id="shell.routine-target#an agent" type="button" class="rtn-mode-btn" data-target="agent" aria-pressed="false">An agent</button>
|
|
1501
|
+
</div>
|
|
1502
|
+
</div>
|
|
1503
|
+
<div class="modal-field" id="rtn-workflow-field">
|
|
1455
1504
|
<label for="rtn-workflow">Workflow</label>
|
|
1456
1505
|
<select data-command-id="shell.routine-workflow" id="rtn-workflow"></select>
|
|
1457
1506
|
</div>
|
|
1507
|
+
<div class="modal-field" id="rtn-agent-field" hidden>
|
|
1508
|
+
<label for="rtn-agent">Agent</label>
|
|
1509
|
+
<select data-command-id="shell.routine-agent" id="rtn-agent"></select>
|
|
1510
|
+
<div class="rtn-mode rtn-agent-ai" id="rtn-agent-ai" role="group" aria-label="AI that runs the agent">
|
|
1511
|
+
<button data-command-id="shell.routine-agent-ai#Claude" type="button" class="rtn-mode-btn active" data-ai="claude" aria-pressed="true">Claude</button>
|
|
1512
|
+
<button data-command-id="shell.routine-agent-ai#Codex" type="button" class="rtn-mode-btn" data-ai="codex" aria-pressed="false">Codex</button>
|
|
1513
|
+
</div>
|
|
1514
|
+
<div class="rtn-cron-hint" id="rtn-agent-note" aria-live="polite"></div>
|
|
1515
|
+
<div class="rtn-cron-hint" id="rtn-agent-empty" hidden>No agents in this workspace folder yet. <button type="button" class="rtn-link" id="rtn-agent-create" data-command-id="shell.routine-agent-create">Create one on the Agents page</button></div>
|
|
1516
|
+
</div>
|
|
1458
1517
|
<!-- Routine kind chooser — schedule vs event-trigger. Hidden unless the picked
|
|
1459
1518
|
workflow is trigger-eligible (its source is a streaming lifecycle:start command). -->
|
|
1460
1519
|
<div class="modal-field" id="rtn-mode-field" hidden>
|
|
@@ -1708,6 +1767,7 @@
|
|
|
1708
1767
|
<script src="left-pane.js"></script>
|
|
1709
1768
|
<script src="chat.js"></script>
|
|
1710
1769
|
<script src="agents.js"></script>
|
|
1770
|
+
<script src="guide.js"></script>
|
|
1711
1771
|
<script src="connections.js"></script>
|
|
1712
1772
|
<script src="local-discovery.js"></script>
|
|
1713
1773
|
<script src="account-menu.js"></script>
|
package/dist/web/instructor.js
CHANGED
|
@@ -194,7 +194,11 @@
|
|
|
194
194
|
);
|
|
195
195
|
}
|
|
196
196
|
// #1996: it runs, but part of its approval record is missing — say so instead of "in sync".
|
|
197
|
-
parts.push(wf.recordIncomplete ? 'part of its approval record is missing' : 'in sync');
|
|
197
|
+
parts.push(wf.recordIncomplete ? 'part of its approval record is missing' : wf.bridgeWarning ? 'its approval is current' : 'in sync');
|
|
198
|
+
if (wf.bridgeWarning) {
|
|
199
|
+
parts.push('a tool’s host bridge needs attention; review the warning above the canvas');
|
|
200
|
+
parts.push('Run is still available and records the warning');
|
|
201
|
+
}
|
|
198
202
|
parts.push(nextStep(wf));
|
|
199
203
|
}
|
|
200
204
|
|
|
@@ -842,8 +846,10 @@
|
|
|
842
846
|
a static array cannot express that, because "active" is runtime state. */
|
|
843
847
|
var GROUP_ORDER = [
|
|
844
848
|
// the shell
|
|
845
|
-
'In the header', 'In the workflow picker', 'In the project picker', 'In the project list', 'On the Workflows page', 'In the workflow picker and on a draft workflow',
|
|
849
|
+
'In the header', 'In the workflow picker', 'In the project picker', 'In the project list', 'On the Workflows page', 'In Archived on the Workflows page', 'In the workflow picker and on a draft workflow',
|
|
846
850
|
'On the Agents page', 'On an agent',
|
|
851
|
+
// #2046: the ways into the Guide on the empty pages, and its first-launch question.
|
|
852
|
+
'Getting started', 'In the Guide question',
|
|
847
853
|
'In the Workspace directory dialog', 'In Tekla source selection', 'In the new project dialog', 'In the project workspace', 'In the Revit workspace', 'In the Tekla Parser workspace', 'In the Drawing Checker profile', 'In Company knowledge',
|
|
848
854
|
'On the workflow canvas', 'In workflow setup dialogs',
|
|
849
855
|
// The Informed by row sits at the top of the canvas column, so it is read right after the canvas.
|
package/dist/web/tool-updates.js
CHANGED
|
@@ -29,6 +29,33 @@
|
|
|
29
29
|
|
|
30
30
|
var view = null;
|
|
31
31
|
var results = null;
|
|
32
|
+
|
|
33
|
+
// ── The view never goes back in time (#2013; also closes #1997's stale-answer race) ──────────────────────
|
|
34
|
+
// Every change to the view comes from a request this page sends — the server's `tool-updates-changed` broadcast only
|
|
35
|
+
// starts a re-read, which is a request like any other. Each request takes a ticket when it is SENT; its answer
|
|
36
|
+
// replaces the view only if no answer to a later-sent request has been applied yet. An older answer still shows its
|
|
37
|
+
// own results and sentence, never its view. Nothing here depends on a server counter, so a server restart with this
|
|
38
|
+
// tab still open changes nothing: the next answer simply applies.
|
|
39
|
+
var sentTicket = 0;
|
|
40
|
+
var appliedTicket = 0;
|
|
41
|
+
|
|
42
|
+
function nextTicket() { sentTicket += 1; return sentTicket; }
|
|
43
|
+
|
|
44
|
+
/** Apply `next` (a whole view, its cleanup beside it) from the request holding `ticket`. False when superseded. */
|
|
45
|
+
function applyView(ticket, next) {
|
|
46
|
+
if (!next || ticket < appliedTicket) return false;
|
|
47
|
+
appliedTicket = ticket;
|
|
48
|
+
view = next;
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Apply a cleanup view on its own (Remove from list answers with only that part), under the same ticket rule. */
|
|
53
|
+
function applyCleanup(ticket, next) {
|
|
54
|
+
if (!view || !next || ticket < appliedTicket) return false;
|
|
55
|
+
appliedTicket = ticket;
|
|
56
|
+
view = Object.assign({}, view, { cleanup: next });
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
32
59
|
var busy = false;
|
|
33
60
|
var returnFocus = null;
|
|
34
61
|
|
|
@@ -52,12 +79,19 @@
|
|
|
52
79
|
return body;
|
|
53
80
|
}
|
|
54
81
|
|
|
82
|
+
// #2013: AWARE's cleanup of unused tool versions, as the server words it (agent-store-cleanup.ts).
|
|
83
|
+
function cleanupNeeds() {
|
|
84
|
+
var c = view && view.cleanup;
|
|
85
|
+
return c && c.supported && Array.isArray(c.needsYou) ? c.needsYou : [];
|
|
86
|
+
}
|
|
87
|
+
|
|
55
88
|
// ── The footer pill ────────────────────────────────────────────────────────
|
|
56
89
|
function paintPill() {
|
|
57
90
|
var offers = view && view.supported ? view.offers || [] : [];
|
|
58
91
|
var needs = view && view.supported ? view.needsYou || [] : [];
|
|
92
|
+
var cleanup = cleanupNeeds();
|
|
59
93
|
var urgent = offers.filter(function (o) { return !!o.advisory; }).length;
|
|
60
|
-
if (!offers.length && !needs.length) {
|
|
94
|
+
if (!offers.length && !needs.length && !cleanup.length) {
|
|
61
95
|
$pill.hidden = true;
|
|
62
96
|
$pill.removeAttribute('data-state');
|
|
63
97
|
if ($modal.classList.contains('show') && !results) paint();
|
|
@@ -78,7 +112,11 @@
|
|
|
78
112
|
}
|
|
79
113
|
} else {
|
|
80
114
|
state = 'needs';
|
|
81
|
-
|
|
115
|
+
var folders = cleanup.filter(function (c) { return c.kind !== 'unreadable'; }).length;
|
|
116
|
+
if (needs.length && cleanup.length) text = (needs.length + cleanup.length) + ' things need you';
|
|
117
|
+
else if (needs.length) text = plural(needs.length, 'workflow needs you', 'workflows need you');
|
|
118
|
+
else if (folders === cleanup.length) text = plural(folders, 'folder needs you', 'folders need you');
|
|
119
|
+
else text = plural(cleanup.length, 'item needs you', 'items need you');
|
|
82
120
|
}
|
|
83
121
|
$pill.textContent = text;
|
|
84
122
|
$pill.setAttribute('data-state', state);
|
|
@@ -149,6 +187,84 @@
|
|
|
149
187
|
return row;
|
|
150
188
|
}
|
|
151
189
|
|
|
190
|
+
var forgetting = null; // the path being removed from the list, while its request is in flight
|
|
191
|
+
|
|
192
|
+
function cleanupRow(item) {
|
|
193
|
+
var row = el('div', 'tool-updates-needs');
|
|
194
|
+
row.setAttribute('data-kind', 'cleanup-' + item.kind);
|
|
195
|
+
row.setAttribute('data-path', item.path);
|
|
196
|
+
var text = el('div', 'tool-updates-needs-text');
|
|
197
|
+
text.appendChild(el('span', 'tool-updates-needs-name', item.name || item.path));
|
|
198
|
+
text.appendChild(el('span', 'tool-updates-needs-sentence', item.sentence));
|
|
199
|
+
row.appendChild(text);
|
|
200
|
+
if (item.action === 'forget-folder') {
|
|
201
|
+
var busyHere = forgetting === item.path;
|
|
202
|
+
var button = el('button', 'tool-updates-open', busyHere ? 'Removing…' : 'Remove from list');
|
|
203
|
+
button.type = 'button';
|
|
204
|
+
button.disabled = busyHere || busy;
|
|
205
|
+
button.setAttribute('data-command-id', 'shell.tool-updates-forget-folder');
|
|
206
|
+
button.setAttribute('data-tip', 'Stop keeping old tool versions for the workflows in this folder');
|
|
207
|
+
button.setAttribute('aria-label', 'Remove ' + (item.name || item.path) + ' from the list');
|
|
208
|
+
button.addEventListener('click', function () { void forgetFolder(item); });
|
|
209
|
+
row.appendChild(button);
|
|
210
|
+
}
|
|
211
|
+
return row;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
async function forgetFolder(item) {
|
|
215
|
+
if (busy || forgetting) return;
|
|
216
|
+
var path = item.path;
|
|
217
|
+
var ok = false;
|
|
218
|
+
forgetting = path;
|
|
219
|
+
paint();
|
|
220
|
+
$live.textContent = 'Removing ' + (item.name || path) + ' from the list…';
|
|
221
|
+
var ticket = nextTicket();
|
|
222
|
+
try {
|
|
223
|
+
var body = await call('/api/tool-updates/forget-folder', 'POST', JSON.stringify({ path: path }));
|
|
224
|
+
applyCleanup(ticket, body.cleanup);
|
|
225
|
+
// The server answers 200 with ok:false when it kept the folder (it came back, or AWARE could not be asked).
|
|
226
|
+
ok = body.ok !== false;
|
|
227
|
+
$live.textContent = body.sentence || (ok ? 'Removed from the list.' : 'Nothing was removed from the list. Try again.');
|
|
228
|
+
} catch (error) {
|
|
229
|
+
if (error.body) applyCleanup(ticket, error.body.cleanup);
|
|
230
|
+
$live.textContent = error.message + ' Nothing was removed from the list.';
|
|
231
|
+
} finally {
|
|
232
|
+
forgetting = null;
|
|
233
|
+
paint();
|
|
234
|
+
paintPill();
|
|
235
|
+
// Focus never drops to the page: the next Remove button, else the section, else the title.
|
|
236
|
+
var next = $body.querySelector('[data-command-id="shell.tool-updates-forget-folder"]:not([disabled])');
|
|
237
|
+
var stay = !ok && $body.querySelector('.tool-updates-needs[data-path="' + CSS.escape(path) + '"] button');
|
|
238
|
+
var head = $body.querySelector('.tool-updates-section-head');
|
|
239
|
+
if (stay) stay.focus();
|
|
240
|
+
else if (next) next.focus();
|
|
241
|
+
else if (head) { head.tabIndex = -1; head.focus(); }
|
|
242
|
+
else $title.focus();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function cleanupLines() {
|
|
247
|
+
var c = view && view.cleanup;
|
|
248
|
+
if (!c) return [];
|
|
249
|
+
// An AWARE too old to clean up: one short line, no pill and no row.
|
|
250
|
+
if (!c.supported) return c.sentence ? [c.sentence] : [];
|
|
251
|
+
var lines = [];
|
|
252
|
+
if (c.sentence) lines.push(c.sentence);
|
|
253
|
+
if (c.waiting === 'runs') lines.push('Cleaning up unused tool versions waits until no workflow is running.');
|
|
254
|
+
else if (c.waiting === 'runs-unknown') lines.push('FloLess could not ask AWARE which workflows are running, so cleaning up unused tool versions waits and tries again later.');
|
|
255
|
+
else if (c.waiting === 'busy') lines.push('Cleaning up unused tool versions waits until AWARE is done with other tool work.');
|
|
256
|
+
else if (c.waiting === 'network-volume') lines.push('AWARE does not clean up tool versions stored on a network drive.');
|
|
257
|
+
var last = c.lastCleanup;
|
|
258
|
+
if (last && last.removed > 0) {
|
|
259
|
+
var at = new Date(last.at);
|
|
260
|
+
var when = isNaN(at.getTime()) ? '' : ' (' + at.toLocaleString([], { day: 'numeric', month: 'short', hour: '2-digit', minute: '2-digit' }) + ')';
|
|
261
|
+
var all = last.tools || [];
|
|
262
|
+
var tools = all.slice(0, 3).join(', ') + (all.length > 3 ? ' and ' + (all.length - 3) + ' more' : '');
|
|
263
|
+
lines.push('Cleaned up ' + plural(last.removed, 'unused tool version', 'unused tool versions') + (tools ? ': ' + tools : '') + when + '.');
|
|
264
|
+
}
|
|
265
|
+
return lines;
|
|
266
|
+
}
|
|
267
|
+
|
|
152
268
|
function section(title, count) {
|
|
153
269
|
var wrap = el('div', 'tool-updates-section');
|
|
154
270
|
wrap.appendChild(el('div', 'tool-updates-section-head', title + ' (' + count + ')'));
|
|
@@ -191,7 +307,43 @@
|
|
|
191
307
|
return 'Downloaded in the background: ' + names.join(', ') + '.';
|
|
192
308
|
}
|
|
193
309
|
|
|
310
|
+
/** Where focus is inside the body, as something that survives a repaint (a refresh can land at any time). */
|
|
311
|
+
function focusKey() {
|
|
312
|
+
var active = document.activeElement;
|
|
313
|
+
if (!active || !$body.contains(active)) return null;
|
|
314
|
+
var row = active.closest && active.closest('.tool-updates-needs');
|
|
315
|
+
return {
|
|
316
|
+
command: active.getAttribute('data-command-id'),
|
|
317
|
+
path: row && row.getAttribute('data-path'),
|
|
318
|
+
app: row && row.getAttribute('data-app'),
|
|
319
|
+
head: active.classList.contains('tool-updates-section-head'),
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
function restoreFocus(key) {
|
|
324
|
+
if (!key) return;
|
|
325
|
+
var target = null;
|
|
326
|
+
if (key.head) target = $body.querySelector('.tool-updates-section-head');
|
|
327
|
+
else if (key.command) {
|
|
328
|
+
target = Array.prototype.find.call($body.querySelectorAll('[data-command-id="' + key.command + '"]'), function (b) {
|
|
329
|
+
var row = b.closest('.tool-updates-needs');
|
|
330
|
+
return !row || (row.getAttribute('data-path') === key.path && row.getAttribute('data-app') === key.app);
|
|
331
|
+
}) || null;
|
|
332
|
+
}
|
|
333
|
+
if (target && target.offsetParent !== null) {
|
|
334
|
+
if (key.head) target.tabIndex = -1;
|
|
335
|
+
target.focus();
|
|
336
|
+
} else {
|
|
337
|
+
$title.focus(); // its row went away: never leave focus on the page behind the dialog
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
194
341
|
function paint() {
|
|
342
|
+
var keepFocus = focusKey();
|
|
343
|
+
try { paintNow(); } finally { restoreFocus(keepFocus); }
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function paintNow() {
|
|
195
347
|
$body.textContent = '';
|
|
196
348
|
$foot.textContent = '';
|
|
197
349
|
var offers = (view && view.offers) || [];
|
|
@@ -223,18 +375,21 @@
|
|
|
223
375
|
$body.appendChild(ready);
|
|
224
376
|
}
|
|
225
377
|
}
|
|
226
|
-
|
|
227
|
-
|
|
378
|
+
var cleanup = cleanupNeeds();
|
|
379
|
+
if (needs.length || cleanup.length) {
|
|
380
|
+
var needsSection = section('Needs you', needs.length + cleanup.length);
|
|
228
381
|
needs.forEach(function (n) { needsSection.appendChild(needsRow(n)); });
|
|
382
|
+
cleanup.forEach(function (n) { needsSection.appendChild(cleanupRow(n)); });
|
|
229
383
|
$body.appendChild(needsSection);
|
|
230
384
|
}
|
|
231
|
-
if (!results && !offers.length && !needs.length && view && view.supported && !view.sentence) {
|
|
385
|
+
if (!results && !offers.length && !needs.length && !cleanup.length && view && view.supported && !view.sentence) {
|
|
232
386
|
$body.appendChild(el('div', 'tool-updates-summary', view.checking
|
|
233
387
|
? 'Checking which workflows a tool update affects…'
|
|
234
388
|
: 'All your workflows are on the tool versions you approved.'));
|
|
235
389
|
}
|
|
236
390
|
var dl = downloadsLine();
|
|
237
391
|
if (dl) $foot.appendChild(el('div', 'tool-updates-downloads', dl));
|
|
392
|
+
cleanupLines().forEach(function (line) { $foot.appendChild(el('div', 'tool-updates-downloads', line)); });
|
|
238
393
|
var checked = lastChecked();
|
|
239
394
|
if (checked) $foot.appendChild(el('div', 'tool-updates-downloads', checked));
|
|
240
395
|
if (!results && offers.length) {
|
|
@@ -251,13 +406,15 @@
|
|
|
251
406
|
busy = on;
|
|
252
407
|
$modal.setAttribute('aria-busy', on ? 'true' : 'false');
|
|
253
408
|
[$check, $cancel, $approve].forEach(function (b) { b.disabled = on; });
|
|
409
|
+
Array.prototype.forEach.call($body.querySelectorAll('[data-command-id="shell.tool-updates-forget-folder"]'), function (b) { b.disabled = on || !!forgetting; });
|
|
254
410
|
if (on && label) $approve.textContent = label;
|
|
255
411
|
}
|
|
256
412
|
|
|
257
413
|
async function refresh() {
|
|
414
|
+
var ticket = nextTicket();
|
|
258
415
|
try {
|
|
259
416
|
var body = await call('/api/tool-updates');
|
|
260
|
-
|
|
417
|
+
applyView(ticket, body);
|
|
261
418
|
} catch (error) {
|
|
262
419
|
// Keep the last answer on screen (and its pill): a dropped request is not "nothing to update".
|
|
263
420
|
console.warn('tool updates unavailable', error);
|
|
@@ -306,9 +463,14 @@
|
|
|
306
463
|
setBusy(true);
|
|
307
464
|
$live.textContent = 'Checking for new tool versions…';
|
|
308
465
|
try {
|
|
309
|
-
|
|
310
|
-
var
|
|
466
|
+
var ticket = nextTicket();
|
|
467
|
+
var answer = await call('/api/tool-updates/check', 'POST');
|
|
468
|
+
applyView(ticket, answer);
|
|
469
|
+
var n = (answer.offers || []).length;
|
|
311
470
|
$live.textContent = n ? plural(n, 'workflow is', 'workflows are') + ' ready to approve.' : 'No workflows to approve.';
|
|
471
|
+
// The cleanup pass Check now started keeps running after this answer, and may already have finished and been
|
|
472
|
+
// re-read: read the server again so this (older) answer never stands over a newer cleanup result.
|
|
473
|
+
void refresh();
|
|
312
474
|
} catch (error) {
|
|
313
475
|
$live.textContent = error.message;
|
|
314
476
|
} finally {
|
|
@@ -326,8 +488,12 @@
|
|
|
326
488
|
setBusy(true, 'Approving…');
|
|
327
489
|
$live.textContent = 'Approving ' + plural(apps.length, 'workflow', 'workflows') + '…';
|
|
328
490
|
try {
|
|
491
|
+
var ticket = nextTicket();
|
|
329
492
|
var body = await call('/api/tool-updates/approve', 'POST', JSON.stringify({ batchId: view.batchId, apps: apps }));
|
|
330
|
-
|
|
493
|
+
// The approval answer carries the batch view and, beside it, the cleanup view (#2013). Its results always show;
|
|
494
|
+
// its view only if nothing newer was applied while the approval ran.
|
|
495
|
+
if (body.view) applyView(ticket, Object.assign({}, body.view, { cleanup: body.cleanup !== undefined ? body.cleanup : (view && view.cleanup) }));
|
|
496
|
+
else applyCleanup(ticket, body.cleanup);
|
|
331
497
|
if (body.ok) {
|
|
332
498
|
results = body.results || [];
|
|
333
499
|
var moved = results.filter(function (r) { return r.outcome === 'moved'; }).length;
|