@floless/app 0.169.0 → 0.171.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 +65531 -43728
- package/dist/schemas/drawing-check.profile.v1.schema.json +12 -2
- package/dist/schemas/steel.model.v2.schema.json +196 -4
- package/dist/skills/floless-app-bridge/SKILL.md +3 -3
- package/dist/skills/floless-app-knowledge/SKILL.md +46 -15
- package/dist/skills/floless-app-new-workflow/SKILL.md +8 -1
- package/dist/skills/floless-app-onboarding/SKILL.md +5 -4
- package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +0 -3
- package/dist/skills/floless-app-queue/SKILL.md +2 -3
- package/dist/skills/floless-app-report-issue/SKILL.md +2 -2
- package/dist/skills/floless-app-routines/SKILL.md +2 -2
- package/dist/skills/floless-app-routines/references/routines-api.md +20 -8
- package/dist/skills/floless-app-steel-model/SKILL.md +42 -39
- package/dist/skills/floless-app-steel-model/references/custom-connections.md +47 -0
- package/dist/skills/floless-app-steel-model/references/custom-sections.md +32 -0
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +31 -1
- package/dist/skills/floless-app-ui/SKILL.md +71 -126
- package/dist/skills/floless-app-workflows/SKILL.md +22 -3
- package/dist/skills/floless-app-workflows/references/agent-steps.md +40 -6
- package/dist/skills/floless-app-workflows/references/exec-contract.md +27 -0
- package/dist/skills/floless-app-workflows/references/script-runner.md +105 -0
- package/dist/web/add-ons.js +407 -0
- package/dist/web/agent-steps.js +89 -18
- package/dist/web/agents.js +32 -22
- package/dist/web/analytics.js +1 -1
- package/dist/web/app.css +331 -190
- package/dist/web/app.js +33 -13
- package/dist/web/aware.js +926 -218
- package/dist/web/chat.css +6 -1
- package/dist/web/chat.js +316 -112
- package/dist/web/checkpoint-standard.js +5 -3
- package/dist/web/commands-drawing-check.js +1 -0
- package/dist/web/commands-filter.js +23 -0
- package/dist/web/commands-shell.js +479 -78
- package/dist/web/commands-steel.js +69 -2
- package/dist/web/commands-tekla-parser.js +23 -0
- package/dist/web/connections.js +14 -3
- package/dist/web/drawing-check-editor.js +352 -88
- package/dist/web/failure-copy.js +33 -2
- package/dist/web/filter-ai-proposal.js +11 -8
- package/dist/web/flo-3d.js +1 -1
- package/dist/web/guide.js +36 -29
- package/dist/web/index.html +98 -57
- package/dist/web/instructor.js +101 -17
- package/dist/web/kb-categories.js +64 -7
- package/dist/web/left-pane.js +4 -1
- package/dist/web/local-discovery.js +8 -7
- package/dist/web/missed-routines.js +239 -0
- package/dist/web/model-change-findings.js +430 -0
- package/dist/web/model-change-review.js +414 -0
- package/dist/web/model-editor-steel-adapter.js +2 -2
- package/dist/web/model-measure.js +6 -0
- package/dist/web/model-spatial-panel.js +19 -4
- package/dist/web/model-spatial-tools.js +3 -3
- package/dist/web/model-viewport-revit-adapter.js +3 -3
- package/dist/web/origin-rule.js +155 -0
- package/dist/web/project-access.js +1 -1
- package/dist/web/project-history.js +7 -1
- package/dist/web/project-modules.js +2 -2
- package/dist/web/project-rfis.js +6 -1
- package/dist/web/project-workflows.js +2 -2
- package/dist/web/revit-editor.css +85 -0
- package/dist/web/revit-editor.js +58 -9
- package/dist/web/run-history.js +12 -1
- package/dist/web/sha256-sync.js +62 -0
- package/dist/web/steel-3d-core.js +46 -9
- package/dist/web/steel-3d-flo.js +153 -7
- package/dist/web/steel-3d-view.js +33 -5
- package/dist/web/steel-ai-marks.js +3 -1
- package/dist/web/steel-custom-connection.js +161 -0
- package/dist/web/steel-custom-sections.js +1796 -0
- package/dist/web/steel-editor.html +732 -161
- package/dist/web/steel-environments.js +297 -0
- package/dist/web/steel-filter-usage.js +299 -0
- package/dist/web/steel-filter.html +104 -6
- package/dist/web/steel-model-v2-client-validation.js +11 -1
- package/dist/web/steel-model-v2-commands.js +116 -13
- package/dist/web/steel-model-v2-projection.js +1 -1
- package/dist/web/steel-read-confidence.js +1 -56
- package/dist/web/step-rename.js +3 -2
- package/dist/web/tekla-editor.html +1 -0
- package/dist/web/terminal-requests.js +1 -1
- package/dist/web/tool-updates.js +7 -6
- package/dist/web/workspaces.js +1968 -138
- package/launch.mjs +87 -9
- package/package.json +4 -1
- package/dist/web/panels.js +0 -831
package/dist/web/instructor.js
CHANGED
|
@@ -137,6 +137,13 @@
|
|
|
137
137
|
chip = 'Locked';
|
|
138
138
|
parts.push(wf.name);
|
|
139
139
|
parts.push(wf.reason || 'is part of a module this account’s plan does not include');
|
|
140
|
+
} else if (wf.awareTooOld && wf.runState !== 'draft') {
|
|
141
|
+
// #3234: steps that run inside AWARE need a newer AWARE. Compile, a reinstall and a run all wait on that.
|
|
142
|
+
tone = 'blocked';
|
|
143
|
+
chip = 'Needs AWARE';
|
|
144
|
+
parts.push(wf.name);
|
|
145
|
+
parts.push('needs AWARE ' + wf.awareTooOld.minimum + ' or newer');
|
|
146
|
+
parts.push('Upgrade AWARE, then Compile');
|
|
140
147
|
} else if (wf.runState === 'drift') {
|
|
141
148
|
tone = 'blocked';
|
|
142
149
|
chip = 'Run blocked';
|
|
@@ -617,7 +624,7 @@
|
|
|
617
624
|
var origin = el && el.ownerDocument === document
|
|
618
625
|
? (snapshot.workspace ? 'workspaces' : 'shell')
|
|
619
626
|
: activeSurface();
|
|
620
|
-
if (!setFocusEntry(f, origin)) return false;
|
|
627
|
+
if (!setFocusEntry(f, origin, el)) return false;
|
|
621
628
|
if (collapsed) setCollapsed(false);
|
|
622
629
|
publishGraftGuidance(paint());
|
|
623
630
|
return true;
|
|
@@ -631,7 +638,7 @@
|
|
|
631
638
|
var origin = el.ownerDocument === document
|
|
632
639
|
? (snapshot.workspace ? 'workspaces' : 'shell')
|
|
633
640
|
: activeSurface();
|
|
634
|
-
if (!setFocusEntry(focusFor(el), origin)) return false;
|
|
641
|
+
if (!setFocusEntry(focusFor(el), origin, el)) return false;
|
|
635
642
|
publishGraftGuidance(paint());
|
|
636
643
|
return true;
|
|
637
644
|
}
|
|
@@ -651,7 +658,7 @@
|
|
|
651
658
|
* nobody cleared this. Worse, "Not available right now" is read off the real
|
|
652
659
|
* element at capture time, so it silently became a fact about a dead document.
|
|
653
660
|
*/
|
|
654
|
-
function setFocusEntry(f, origin) {
|
|
661
|
+
function setFocusEntry(f, origin, el) {
|
|
655
662
|
if (!f) return false;
|
|
656
663
|
/* The ORIGIN IS PASSED IN, never guessed from activeSurface(). The two differ:
|
|
657
664
|
the contract-editor overlay covers the shell without unmounting it, so while a
|
|
@@ -663,15 +670,93 @@
|
|
|
663
670
|
nothing better, which is explain()'s hover/focus path — where a child overlay
|
|
664
671
|
means the pointer cannot be on a shell control anyway. */
|
|
665
672
|
f.originSurface = origin || 'shell';
|
|
673
|
+
f.carrier = carrierOf(el);
|
|
666
674
|
snapshot.focus = f;
|
|
675
|
+
if (f.carrier) watchCarrierDocument(f.carrier.doc);
|
|
667
676
|
return true;
|
|
668
677
|
}
|
|
669
678
|
|
|
670
|
-
|
|
671
|
-
|
|
679
|
+
/* #2498: the control an entry was read off, kept as the document it lives in and its exact
|
|
680
|
+
`data-command-id` (template and instance), never as the element. A repaint that rebuilds a row
|
|
681
|
+
replaces the element and keeps the control, so the element going is not the control going; no
|
|
682
|
+
carrier with that id left in that document is. Only a registered control is tracked: the
|
|
683
|
+
registry's own description (describeCommand) explains a command wherever it lives, and an
|
|
684
|
+
unregistered control has no id that survives a rebuild. */
|
|
685
|
+
function carrierOf(el) {
|
|
686
|
+
if (!el || !el.getAttribute) return null;
|
|
687
|
+
var carrier = el.getAttribute('data-command-id') ? el : null;
|
|
688
|
+
/* A switch's label or track is what the pointer lands on, and the id may sit on the input it labels
|
|
689
|
+
(#1035): focusFor() explains that input, so that input is the control to watch, not an ancestor. */
|
|
690
|
+
if (!carrier && el.closest) {
|
|
691
|
+
var labelled = el.closest('label');
|
|
692
|
+
var named = labelled && (labelled.control || labelled.querySelector('input, select, textarea'));
|
|
693
|
+
carrier = named && named.getAttribute && named.getAttribute('data-command-id') ? named : el.closest('[data-command-id]');
|
|
694
|
+
}
|
|
695
|
+
var id = carrier && carrier.getAttribute('data-command-id');
|
|
696
|
+
return id && carrier.ownerDocument ? { doc: carrier.ownerDocument, id: id } : null;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
/* Whether the entry's control has left its surface. Not for a surface that is hidden: a workspace tab
|
|
700
|
+
switched away still holds its controls. A frame that unloads is the reporter-gone path's to clear.
|
|
701
|
+
What does not count as the control: a `?` sheet row, and the notes the shell writes the explained id
|
|
702
|
+
onto (the Build a tool and saved-directories notes carry it as their own `data-command-id`). */
|
|
703
|
+
var NOT_A_CARRIER = '#command-sheet, #graft-instructor-note, #workspace-root-instructor-note';
|
|
704
|
+
function focusCarrierGone() {
|
|
705
|
+
var c = snapshot.focus && snapshot.focus.carrier;
|
|
706
|
+
if (!c) return false;
|
|
707
|
+
try {
|
|
708
|
+
if (c.doc !== document && hiddenReporter(c.doc.defaultView)) return false;
|
|
709
|
+
// Only the exact id is read where the browser can quote it: this runs after every repaint while an entry stands.
|
|
710
|
+
var escape = typeof CSS === 'object' && CSS && typeof CSS.escape === 'function' ? CSS.escape : null;
|
|
711
|
+
var all = c.doc.querySelectorAll(escape ? '[data-command-id="' + escape(c.id) + '"]' : '[data-command-id]');
|
|
712
|
+
for (var i = 0; i < all.length; i++) {
|
|
713
|
+
var n = all[i];
|
|
714
|
+
if (n.isConnected !== false && n.getAttribute('data-command-id') === c.id
|
|
715
|
+
&& !(n.closest && n.closest(NOT_A_CARRIER))) return false;
|
|
716
|
+
}
|
|
717
|
+
return true;
|
|
718
|
+
} catch (e) { return false; }
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
// The one way an entry is retired for a control that went away: the band and both grafted bands.
|
|
722
|
+
function retireFocusEntry() {
|
|
672
723
|
snapshot.focus = null;
|
|
673
724
|
if (typeof window.flolessGraftInstructorClear === 'function') window.flolessGraftInstructorClear();
|
|
674
725
|
if (typeof window.flolessWorkspaceRootInstructorClear === 'function') window.flolessWorkspaceRootInstructorClear();
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
/* A repaint needs no input event to remove a control (the Drawing Checker re-reads its references
|
|
729
|
+
when they change elsewhere, #2482), so the child's reporter has nothing to say when it happens.
|
|
730
|
+
The shell watches the document itself and checks once, after the task that changed it: a repaint
|
|
731
|
+
that rebuilds a row in one go keeps the entry. One that shows a placeholder and fills in after a
|
|
732
|
+
network wait retires it in between, which is true while it lasts: the control is not there. */
|
|
733
|
+
var carrierCheckPending = false;
|
|
734
|
+
var carrierDocuments = typeof WeakSet === 'function' ? new WeakSet() : [];
|
|
735
|
+
function watchCarrierDocument(doc) {
|
|
736
|
+
if (!doc || typeof MutationObserver !== 'function') return;
|
|
737
|
+
if (carrierDocuments instanceof Array ? carrierDocuments.indexOf(doc) !== -1 : carrierDocuments.has(doc)) return;
|
|
738
|
+
try {
|
|
739
|
+
new MutationObserver(scheduleCarrierCheck)
|
|
740
|
+
.observe(doc, { childList: true, subtree: true, attributes: true, attributeFilter: ['data-command-id'] });
|
|
741
|
+
} catch (e) { return; }
|
|
742
|
+
if (carrierDocuments instanceof Array) carrierDocuments.push(doc); else carrierDocuments.add(doc);
|
|
743
|
+
}
|
|
744
|
+
function scheduleCarrierCheck() {
|
|
745
|
+
if (carrierCheckPending || !(snapshot.focus && snapshot.focus.carrier)) return;
|
|
746
|
+
carrierCheckPending = true;
|
|
747
|
+
setTimeout(function () {
|
|
748
|
+
carrierCheckPending = false;
|
|
749
|
+
if (!focusCarrierGone()) return;
|
|
750
|
+
retireFocusEntry();
|
|
751
|
+
// paint(), not publishGraftGuidance(paint()): the notes were just cleared, and the readout under the
|
|
752
|
+
// entry is the band's, never theirs.
|
|
753
|
+
paint();
|
|
754
|
+
}, 0);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
function clearFocusEntry() {
|
|
758
|
+
if (!snapshot.focus) return;
|
|
759
|
+
retireFocusEntry();
|
|
675
760
|
paint();
|
|
676
761
|
}
|
|
677
762
|
|
|
@@ -878,10 +963,12 @@
|
|
|
878
963
|
'At the left edge of the workspace', 'At the edge of the left or Inspect panel', 'In the left panel', 'Between AI Chat and Model', 'In the Model section of the left panel', 'In the Grid object in the Model section',
|
|
879
964
|
'In AI Chat', 'In AI Chat history', 'In AI Chat settings', 'In the node Inspect panel', 'In the Instructor strip',
|
|
880
965
|
'In the ≡ menu', 'In the account menu', 'In the footer',
|
|
881
|
-
'In the contract editor', 'In the report viewer', 'In the Page viewer', 'In My shared links', 'In the video player', 'In the Knowledge Base viewer', 'In a PDF FloLess shows',
|
|
882
|
-
'In the Tools library', 'In Discover local tools', 'In the requests list', 'In the revision review', 'In the run request dialog', 'In the Integrations dialog', 'In the Routines dialog', 'In the Automatic tool updates dialog', 'In the terminal requests dialog',
|
|
966
|
+
'In the contract editor', 'In the report viewer', 'In the Page viewer', 'In My shared links', 'In My add-ons', 'In the video player', 'In the Knowledge Base viewer', 'In a PDF FloLess shows',
|
|
967
|
+
'In the Tools library', 'In Discover local tools', 'In the requests list', 'In the revision review', 'In the run request dialog', 'In the Integrations dialog', 'In the Disconnect dialog', 'In the Routines dialog', 'On the missed-runs card', 'In the Automatic tool updates dialog', 'In the terminal requests dialog',
|
|
883
968
|
'In the Report an issue dialog', 'In the Build a tool dialog', 'In the Bake dialog', 'In the CAD send review',
|
|
884
|
-
|
|
969
|
+
// #3312: the profile mapping window opens from the CAD send review, so it is read right after it.
|
|
970
|
+
'In the profile mapping window',
|
|
971
|
+
'While FloLess is not answering', 'In the FloLess dialogs', 'On the FloLess has stopped screen',
|
|
885
972
|
// #2381: the first-run setup card, which covers the whole window until AWARE is ready.
|
|
886
973
|
'On the setup card',
|
|
887
974
|
// #2786: the full-window sign-in screen, shown whenever the subscription gate locks FloLess.
|
|
@@ -904,7 +991,7 @@
|
|
|
904
991
|
'In the confidence report', 'In the Ask AI panel', 'In the Ask AI dialog', 'In the Favourites dialog',
|
|
905
992
|
// the read-only Revit model editor
|
|
906
993
|
'In the Revit model header', 'In the Revit model toolbar', 'In the Revit Saved views panel', 'In the Revit model coordinate HUD', 'In the Revit model selection bar', 'In the Revit model snapping bar', 'In the Revit spatial controls',
|
|
907
|
-
'In the Tekla Parser header', 'In the Tekla Parser hierarchy', 'In the Tekla Parser model toolbar', 'In the Tekla Parser Saved views panel', 'In the Tekla Parser coordinate HUD', 'In the Tekla Parser selection bar', 'In the Tekla Parser snapping bar', 'In the Tekla Parser spatial controls', 'In the Tekla Parser Audit pane',
|
|
994
|
+
'In the Tekla Parser header', 'In the Tekla Parser hierarchy', 'In the Tekla Parser model toolbar', 'In the Tekla Parser Saved views panel', 'In the Tekla Parser coordinate HUD', 'In the Tekla Parser selection bar', 'In the Tekla Parser snapping bar', 'In the Tekla Parser spatial controls', 'In the Tekla Parser Audit pane', 'In the Tekla Parser Changes pane',
|
|
908
995
|
// the drawing filter
|
|
909
996
|
'In the Drawing Filter header', 'In a Drawing Filter message',
|
|
910
997
|
'In the Drawing Filter panel', 'On the Drawing Filter canvas',
|
|
@@ -1227,7 +1314,7 @@
|
|
|
1227
1314
|
the stale-narration bug this commit exists to fix, one level down. Falling
|
|
1228
1315
|
through instead means the registry describes the command, which is a better
|
|
1229
1316
|
answer than the blank the old `snapshot.focus = focusFor(live)` produced. */
|
|
1230
|
-
if (setFocusEntry(focusFor(live), liveOrigin)) {
|
|
1317
|
+
if (setFocusEntry(focusFor(live), liveOrigin, live)) {
|
|
1231
1318
|
paint();
|
|
1232
1319
|
return;
|
|
1233
1320
|
}
|
|
@@ -1244,7 +1331,7 @@
|
|
|
1244
1331
|
if (hidden.el.ownerDocument !== document && (activeReporterWindow !== reporter || !snapshot.child)) return;
|
|
1245
1332
|
var shown = revealCarrier(hidden.el, matchesCommand);
|
|
1246
1333
|
// `shown` has focus, or is disabled (its menus closed again) and narrates why; an entry the registry cannot build falls back to the command's own.
|
|
1247
|
-
if (shown && setFocusEntry(focusFor(shown), hidden.origin)) {
|
|
1334
|
+
if (shown && setFocusEntry(focusFor(shown), hidden.origin, shown)) {
|
|
1248
1335
|
paint();
|
|
1249
1336
|
return;
|
|
1250
1337
|
}
|
|
@@ -1746,13 +1833,10 @@
|
|
|
1746
1833
|
/* Async child state can remove a command without moving focus (the display-unit
|
|
1747
1834
|
Retry button is the first case). The reporter names commands that disappeared,
|
|
1748
1835
|
so the producer can retire only the exact captured entry instead of either
|
|
1749
|
-
narrating dead UI or clearing unrelated shell guidance.
|
|
1836
|
+
narrating dead UI or clearing unrelated shell guidance. A surface that names
|
|
1837
|
+
none is checked directly (#2498): the entry goes when its control has. */
|
|
1750
1838
|
var hiddenCommands = childSnap && Array.isArray(childSnap.hiddenCommands) ? childSnap.hiddenCommands : [];
|
|
1751
|
-
if (snapshot.focus && hiddenCommands.indexOf(snapshot.focus.commandId) !== -1)
|
|
1752
|
-
snapshot.focus = null;
|
|
1753
|
-
if (typeof window.flolessGraftInstructorClear === 'function') window.flolessGraftInstructorClear();
|
|
1754
|
-
if (typeof window.flolessWorkspaceRootInstructorClear === 'function') window.flolessWorkspaceRootInstructorClear();
|
|
1755
|
-
}
|
|
1839
|
+
if (snapshot.focus && (hiddenCommands.indexOf(snapshot.focus.commandId) !== -1 || focusCarrierGone())) retireFocusEntry();
|
|
1756
1840
|
paint();
|
|
1757
1841
|
|
|
1758
1842
|
// shell → child: hand back what the producer made.
|
|
@@ -313,16 +313,30 @@ function kbgView(model, file, opts) {
|
|
|
313
313
|
function kbgLegend(model, file) {
|
|
314
314
|
const member = kbgMembership(model, file);
|
|
315
315
|
const count = new Map();
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
316
|
+
// #3413: how many of each are files and how many pages, so a chip can say what its number counts.
|
|
317
|
+
const files = new Map();
|
|
318
|
+
for (const [id, m] of member.entries()) {
|
|
319
|
+
const doc = model.nodes.get(id)?.kind === 'document';
|
|
320
|
+
const keys = m.grouped ? m.cats : ['ungrouped'];
|
|
321
|
+
for (const c of keys) { count.set(c, (count.get(c) || 0) + 1); if (doc) files.set(c, (files.get(c) || 0) + 1); }
|
|
319
322
|
}
|
|
320
|
-
const
|
|
321
|
-
|
|
322
|
-
if (count.get('
|
|
323
|
+
const chip = (id, name, extra) => ({ id, name, n: count.get(id), files: files.get(id) || 0, pages: count.get(id) - (files.get(id) || 0), ...extra });
|
|
324
|
+
const chips = kbcChildren(file, null).filter((c) => count.get(c.id)).map((c) => chip(c.id, c.name, kbgColour(file, c.id)));
|
|
325
|
+
if (count.get('uncategorized')) chips.push(chip('uncategorized', 'Uncategorized', { token: '--text-muted', hatch: false }));
|
|
326
|
+
if (count.get('ungrouped')) chips.push(chip('ungrouped', 'Not yet grouped', { token: '--text-muted', hatch: false, dashed: true }));
|
|
323
327
|
return chips;
|
|
324
328
|
}
|
|
325
329
|
|
|
330
|
+
/**
|
|
331
|
+
* #3413: what a legend chip's number counts, in words — the map counts files and the pages made from them, while the
|
|
332
|
+
* reference list counts files, so the two numbers differ for one category and must say why.
|
|
333
|
+
*/
|
|
334
|
+
function kbgChipTip(c) {
|
|
335
|
+
const parts = [c.files ? `${c.files} file${c.files === 1 ? '' : 's'}` : '', c.pages ? `${c.pages} page${c.pages === 1 ? '' : 's'}${c.files ? ` made from ${c.files === 1 ? 'it' : 'them'}` : ''}` : '']
|
|
336
|
+
.filter(Boolean).join(' and ');
|
|
337
|
+
return `Show or hide ${c.name}. ${c.n} item${c.n === 1 ? '' : 's'} on the map: ${parts}.`;
|
|
338
|
+
}
|
|
339
|
+
|
|
326
340
|
/** From the focused node, the nearest drawn neighbour in a direction (for the arrow keys). */
|
|
327
341
|
function kbgNearest(pos, from, dir, candidates) {
|
|
328
342
|
const p = pos.get(from);
|
|
@@ -342,10 +356,53 @@ function kbgNearest(pos, from, dir, candidates) {
|
|
|
342
356
|
return best;
|
|
343
357
|
}
|
|
344
358
|
|
|
359
|
+
/**
|
|
360
|
+
* #3413: where each map label goes, so labels never sit on each other or on a dot. Documents first, then the most
|
|
361
|
+
* linked, then the shortest name; each tries right, left, below, above, first at full length (up to 40 characters) then
|
|
362
|
+
* cut to 18. A label with no free spot is hidden: it shows when its node is pointed at, focused, next to the one pointed
|
|
363
|
+
* at, or a search match, and its name is always in the node's tooltip and accessible name. Measured in layout units
|
|
364
|
+
* (the labels scale with the map), so one plan holds at every zoom. `items`: [{ id, label, doc, degree }];
|
|
365
|
+
* `pos`: Map id → {x, y}; `bounds`: { w, h }; `measure(text)`: the label's width in layout units, measured with the
|
|
366
|
+
* label's own font in the browser (a wide-letter estimate when there is none). Returns Map id → { side: 'r'|'l'|'b'|'t', text } or { hidden: true }.
|
|
367
|
+
*/
|
|
368
|
+
const KBG_CHAR_W = 9, KBG_LINE_H = 14, KBG_DOT_R = 10, KBG_PAD = 2;
|
|
369
|
+
function kbgLabelPlan(items, pos, bounds, measure) {
|
|
370
|
+
const width = typeof measure === 'function' ? measure : (t) => t.length * KBG_CHAR_W;
|
|
371
|
+
const placed = [];
|
|
372
|
+
const hit = (a) => placed.some((b) => a.x0 < b.x1 + KBG_PAD && b.x0 < a.x1 + KBG_PAD && a.y0 < b.y1 + KBG_PAD && b.y0 < a.y1 + KBG_PAD);
|
|
373
|
+
const inside = (a) => !bounds || (a.x0 >= 0 && a.y0 >= 0 && a.x1 <= bounds.w && a.y1 <= bounds.h);
|
|
374
|
+
for (const it of items) {
|
|
375
|
+
const p = pos.get(it.id);
|
|
376
|
+
if (p) placed.push({ x0: p.x - KBG_DOT_R, x1: p.x + KBG_DOT_R, y0: p.y - KBG_DOT_R, y1: p.y + KBG_DOT_R });
|
|
377
|
+
}
|
|
378
|
+
const order = [...items].filter((it) => pos.get(it.id)).sort((a, b) => (Number(!!b.doc) - Number(!!a.doc)) || (b.degree - a.degree)
|
|
379
|
+
|| (a.label.length - b.label.length) || (a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
380
|
+
const box = (p, side, w) => side === 'r' ? { x0: p.x + 13, x1: p.x + 13 + w, y0: p.y - 10, y1: p.y + 4 }
|
|
381
|
+
: side === 'l' ? { x0: p.x - 13 - w, x1: p.x - 13, y0: p.y - 10, y1: p.y + 4 }
|
|
382
|
+
: side === 'b' ? { x0: p.x - w / 2, x1: p.x + w / 2, y0: p.y + 12, y1: p.y + 12 + KBG_LINE_H }
|
|
383
|
+
: { x0: p.x - w / 2, x1: p.x + w / 2, y0: p.y - 12 - KBG_LINE_H, y1: p.y - 12 };
|
|
384
|
+
const plan = new Map();
|
|
385
|
+
for (const it of order) {
|
|
386
|
+
const p = pos.get(it.id);
|
|
387
|
+
const full = it.label.length > 40 ? `${it.label.slice(0, 39)}…` : it.label;
|
|
388
|
+
const texts = full.length > 18 ? [full, `${it.label.slice(0, 17)}…`] : [full];
|
|
389
|
+
let done = null;
|
|
390
|
+
for (const text of texts) {
|
|
391
|
+
for (const side of ['r', 'l', 'b', 't']) {
|
|
392
|
+
const b = box(p, side, width(text));
|
|
393
|
+
if (inside(b) && !hit(b)) { done = { side, text }; placed.push(b); break; }
|
|
394
|
+
}
|
|
395
|
+
if (done) break;
|
|
396
|
+
}
|
|
397
|
+
plan.set(it.id, done || { hidden: true });
|
|
398
|
+
}
|
|
399
|
+
return plan;
|
|
400
|
+
}
|
|
401
|
+
|
|
345
402
|
if (typeof module !== 'undefined' && module.exports) {
|
|
346
403
|
module.exports = {
|
|
347
404
|
KBC_COLORS, KBC_RENDER_CAP, kbcChildren, kbcPath, kbcLabel, kbcTop, kbcPlacement, kbcSubtree, kbcCounts, kbcTreeItems,
|
|
348
405
|
kbcAncestors, kbcMenuChoices, kbcReorderOps, kbcSelect, kbcSelectAll, kbcPrune,
|
|
349
|
-
kbgCreate, kbgMerge, kbgMembership, kbgColour, kbgView, kbgLegend, kbgNearest,
|
|
406
|
+
kbgCreate, kbgMerge, kbgMembership, kbgColour, kbgView, kbgLegend, kbgChipTip, kbgLabelPlan, kbgNearest,
|
|
350
407
|
};
|
|
351
408
|
}
|
package/dist/web/left-pane.js
CHANGED
|
@@ -1147,7 +1147,10 @@
|
|
|
1147
1147
|
.find((row) => !pending.seenPaths.has(row.dataset.occurrencePath));
|
|
1148
1148
|
firstNew?.focus();
|
|
1149
1149
|
}
|
|
1150
|
-
|
|
1150
|
+
// #3097: the frame's `message` is not thrown text: model-panel-bridge.js writes every one as a fixed sentence for
|
|
1151
|
+
// the person ("That model group has changed. Try opening it again.").
|
|
1152
|
+
const frameSentence = typeof data.message === 'string' ? data.message : '';
|
|
1153
|
+
if (!data.ok) status.textContent = frameSentence || 'That model action is no longer available.';
|
|
1151
1154
|
// The frame stays empty, so say so where the tab would be — for the tab still shown, not an earlier one.
|
|
1152
1155
|
if (pending?.kind === 'panel' && !data.ok && pending.key === panelShown) {
|
|
1153
1156
|
panelShown = null;
|
|
@@ -41,12 +41,13 @@
|
|
|
41
41
|
});
|
|
42
42
|
} catch (error) {
|
|
43
43
|
if (error.name === 'AbortError') throw error;
|
|
44
|
-
throw new Error('FloLess could not reach the local scan. Check that FloLess is open, then try again.');
|
|
44
|
+
throw Object.assign(new Error('FloLess could not reach the local scan. Check that FloLess is open, then try again.'), { forPerson: true });
|
|
45
45
|
}
|
|
46
46
|
const data = await response.json().catch(() => ({}));
|
|
47
47
|
if (!response.ok || !data.ok) {
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
// #3097: the reply rides on the error, so errorText works the sentence out from it (personText, else the shared
|
|
49
|
+
// sentence) and a reply marked diagnostic never reaches the status line.
|
|
50
|
+
const error = Object.assign(new Error('local discovery request refused'), { status: response.status, body: data });
|
|
50
51
|
error.code = data.code;
|
|
51
52
|
error.expiredSelectionIds = Array.isArray(data.expiredSelectionIds) ? data.expiredSelectionIds : null;
|
|
52
53
|
throw error;
|
|
@@ -126,8 +127,8 @@
|
|
|
126
127
|
resetResults();
|
|
127
128
|
status.textContent = 'Scope changed. Scan again to see current findings.';
|
|
128
129
|
} catch (error) {
|
|
129
|
-
status.textContent = error
|
|
130
|
-
|
|
130
|
+
status.textContent = errorText(error, { action: 'remove this folder from the next scan',
|
|
131
|
+
unsure: 'It is still listed, so try Remove again.' });
|
|
131
132
|
}
|
|
132
133
|
}));
|
|
133
134
|
row.append(remove);
|
|
@@ -431,7 +432,7 @@
|
|
|
431
432
|
paintFolders();
|
|
432
433
|
status.textContent = 'Expired folder choices were removed. Scan again, or add those folders again.';
|
|
433
434
|
} else if (error.name !== 'AbortError' && generation === scanGeneration) {
|
|
434
|
-
status.textContent = error
|
|
435
|
+
status.textContent = errorText(error, { action: 'check those locations', retrySafe: true });
|
|
435
436
|
}
|
|
436
437
|
} finally {
|
|
437
438
|
if (generation === scanGeneration) { scanController = null; setBusy(false); }
|
|
@@ -451,7 +452,7 @@
|
|
|
451
452
|
resetResults();
|
|
452
453
|
status.textContent = 'Folder added to the next scan. Up to three selected folders can be included. No scan has started.';
|
|
453
454
|
}
|
|
454
|
-
} catch (error) { status.textContent = error
|
|
455
|
+
} catch (error) { status.textContent = errorText(error, { action: 'choose that folder', unsure: 'Check the folder list, or try another local folder.' }); }
|
|
455
456
|
}));
|
|
456
457
|
scanButton.addEventListener('click', scan);
|
|
457
458
|
filterInput.addEventListener('input', () => { page = 0; paintPage(); });
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
/* Routines that missed their time while FloLess was closed (owner ruling 2026-11-06, plan
|
|
2
|
+
* docs/superpowers/specs/2026-11-06-missed-routine-catch-up-offer-plan.md).
|
|
3
|
+
*
|
|
4
|
+
* The server keeps ONE open question per routine (`missedOffer` on GET /api/routines), however many times it was missed.
|
|
5
|
+
* This is the card that asks it, bottom right, always one card: one routine reads "Run now / Skip"; two or more get a
|
|
6
|
+
* tick box each (none ticked — a run can write to a model or use an AI subscription, so running is always a choice),
|
|
7
|
+
* "Run selected (n)" and "Skip all". Nothing runs on its own. Run goes through the routine's own run route (every gate
|
|
8
|
+
* applies) and names the question it answers, so a second tab cannot answer it twice. × is "Later": the card stays away
|
|
9
|
+
* in this tab until another routine misses its time; Routines says what still waits and reopens it. The card stays out
|
|
10
|
+
* of the way of any open dialog.
|
|
11
|
+
*
|
|
12
|
+
* aware.js hands every routines list it loads to `update()`; this module renders only.
|
|
13
|
+
*/
|
|
14
|
+
(() => {
|
|
15
|
+
const state = {
|
|
16
|
+
offers: [], // [{ routineId, offerId, name, first, last, count, atLeast, starting, ai }]
|
|
17
|
+
ticked: new Set(), // offer ids
|
|
18
|
+
later: new Set(), // offer ids the person set aside in this tab
|
|
19
|
+
answered: new Set(), // offer ids answered from this tab (their leaving needs no note)
|
|
20
|
+
busy: false,
|
|
21
|
+
ctx: null, // { api, reportErr, reload }
|
|
22
|
+
};
|
|
23
|
+
let card = null;
|
|
24
|
+
|
|
25
|
+
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[c]));
|
|
26
|
+
const toast = (text, kind) => { if (typeof showToast === 'function') showToast(text, kind); };
|
|
27
|
+
const AI_TIP = 'Runs an AI agent and uses your AI subscription';
|
|
28
|
+
const BUSY_REASON = 'Sending your answer. This works again in a moment.';
|
|
29
|
+
// While an answer is on its way every control waits, and says why.
|
|
30
|
+
const busyAttr = () => (state.busy ? `disabled data-blocked-reason="${BUSY_REASON}"` : '');
|
|
31
|
+
|
|
32
|
+
/** "07:00", plus the day when it was not today — the person's own clock, as the routine's runs say it. */
|
|
33
|
+
function clock(iso) {
|
|
34
|
+
const at = new Date(iso);
|
|
35
|
+
if (Number.isNaN(at.getTime())) return '';
|
|
36
|
+
const hm = `${String(at.getHours()).padStart(2, '0')}:${String(at.getMinutes()).padStart(2, '0')}`;
|
|
37
|
+
if (at.toDateString() === new Date().toDateString()) return hm;
|
|
38
|
+
return `${hm} on ${at.toLocaleDateString('en-GB', { weekday: 'short', day: 'numeric', month: 'short' })}`;
|
|
39
|
+
}
|
|
40
|
+
const why = (o) => (o.starting ? 'FloLess was still starting up' : 'FloLess was closed');
|
|
41
|
+
const times = (o) => `${o.atLeast ? 'at least ' : ''}${o.count} times`;
|
|
42
|
+
function rowSub(o) {
|
|
43
|
+
// Past the count cap the last time is only where counting stopped, so the row says since when instead.
|
|
44
|
+
if (o.atLeast) return `Missed ${times(o)} since ${clock(o.first)}`;
|
|
45
|
+
return o.count === 1 ? `Missed at ${clock(o.last)}` : `Missed ${times(o)}, last at ${clock(o.last)}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** The open questions in a routines list: a schedule routine that would still run (on, not broken, agent not held). */
|
|
49
|
+
function offersOf(routines) {
|
|
50
|
+
return (Array.isArray(routines) ? routines : []).flatMap((r) => {
|
|
51
|
+
const o = r && r.missedOffer;
|
|
52
|
+
if (!o || r.kind === 'trigger' || !r.enabled || r.broken || r.agentHold) return [];
|
|
53
|
+
return [{ routineId: r.id, offerId: o.id, name: r.name || r.id, first: o.first, last: o.last, count: o.count,
|
|
54
|
+
atLeast: o.atLeast === true, starting: o.starting === true, ai: !!r.agent || r.aiStep === true }];
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function update(routines, ctx) {
|
|
59
|
+
if (ctx) state.ctx = ctx;
|
|
60
|
+
const next = offersOf(routines);
|
|
61
|
+
const nextIds = new Set(next.map((o) => o.offerId));
|
|
62
|
+
// A question that left on its own while the card showed it says so — without claiming it ran: it may have run on
|
|
63
|
+
// its schedule, been switched off, or been answered in another tab.
|
|
64
|
+
if (card && !card.hidden) {
|
|
65
|
+
const gone = state.offers.filter((o) => !nextIds.has(o.offerId) && !state.answered.has(o.offerId)
|
|
66
|
+
&& !next.some((n) => n.routineId === o.routineId));
|
|
67
|
+
for (const o of gone) toast(`“${o.name}” is no longer waiting for an answer: it ran on its schedule, was switched off or was answered elsewhere.`, 'info');
|
|
68
|
+
}
|
|
69
|
+
state.offers = next;
|
|
70
|
+
for (const id of [...state.ticked]) if (!nextIds.has(id)) state.ticked.delete(id);
|
|
71
|
+
render();
|
|
72
|
+
paintRoutinesNote();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function visibleOffers() { return state.offers.filter((o) => !state.later.has(o.offerId)); }
|
|
76
|
+
|
|
77
|
+
function ensureCard() {
|
|
78
|
+
if (card && card.isConnected) return card;
|
|
79
|
+
const container = document.getElementById('toast-container');
|
|
80
|
+
if (!container) return null;
|
|
81
|
+
card = document.createElement('section');
|
|
82
|
+
card.className = 'toast warn missed-card';
|
|
83
|
+
card.id = 'missed-routines-card';
|
|
84
|
+
card.setAttribute('role', 'region');
|
|
85
|
+
card.setAttribute('aria-label', 'Routines that missed their time');
|
|
86
|
+
card.hidden = true;
|
|
87
|
+
card.addEventListener('click', onClick);
|
|
88
|
+
card.addEventListener('change', onChange);
|
|
89
|
+
container.prepend(card);
|
|
90
|
+
return card;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function render() {
|
|
94
|
+
// Shown while at least one question has not been set aside; once shown, it lists every open one.
|
|
95
|
+
const show = visibleOffers().length > 0;
|
|
96
|
+
const offers = state.offers;
|
|
97
|
+
if (!show) { if (card) { card.hidden = true; card.innerHTML = ''; } return; }
|
|
98
|
+
const el = ensureCard();
|
|
99
|
+
if (!el) return;
|
|
100
|
+
// A repaint keeps the person's place: focus goes back to the same control (same command, same routine). When that
|
|
101
|
+
// control is gone — the card changed shape — it goes to Later, never to a different action a keypress would start.
|
|
102
|
+
const focusables = () => [...el.querySelectorAll('button, input, [tabindex="0"]')];
|
|
103
|
+
const keyOf = (node) => `${node.getAttribute('data-command-id') || ''}|${node.getAttribute('data-offer') || ''}`;
|
|
104
|
+
const hadFocus = el.contains(document.activeElement) ? keyOf(document.activeElement) : null;
|
|
105
|
+
el.hidden = false;
|
|
106
|
+
el.classList.toggle('busy', state.busy);
|
|
107
|
+
el.innerHTML = offers.length === 1 ? singleHtml(offers[0]) : manyHtml(offers);
|
|
108
|
+
if (hadFocus !== null) {
|
|
109
|
+
const list = focusables();
|
|
110
|
+
(list.find((node) => keyOf(node) === hadFocus && !node.disabled) || el.querySelector('[data-missed="later"]'))?.focus();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const laterButton = () => '<button type="button" class="toast-close missed-later" data-missed="later" data-command-id="shell.missed-routines-later" aria-label="Later" data-tip="Later. Nothing runs; Routines keeps these waiting for your answer.">×</button>';
|
|
115
|
+
const aiPill = (o) => (o.ai ? `<span class="ai-pill" tabindex="0" data-tip="${esc(AI_TIP)}">AI</span>` : '');
|
|
116
|
+
|
|
117
|
+
function singleHtml(o) {
|
|
118
|
+
const what = o.count === 1
|
|
119
|
+
? `didn’t run at ${esc(clock(o.last))} because ${why(o)}.`
|
|
120
|
+
: o.atLeast
|
|
121
|
+
? `missed ${esc(times(o))} since ${esc(clock(o.first))}, because ${why(o)}. It runs once.`
|
|
122
|
+
: `missed ${esc(times(o))}, the last at ${esc(clock(o.last))}, because ${why(o)}. It runs once.`;
|
|
123
|
+
return `
|
|
124
|
+
<div class="missed-head"><span class="missed-title">A routine missed its time</span>${laterButton()}</div>
|
|
125
|
+
<p class="missed-text"><strong>${esc(o.name)}</strong>${aiPill(o)} ${what} Run it now?</p>
|
|
126
|
+
${o.ai ? `<p class="missed-foot">${esc(AI_TIP)}.</p>` : ''}
|
|
127
|
+
<div class="missed-actions">
|
|
128
|
+
<button type="button" class="toast-action missed-primary" data-missed="run-one" data-command-id="shell.missed-routines-run" ${busyAttr()}>Run now</button>
|
|
129
|
+
<button type="button" class="toast-action" data-missed="skip-one" data-command-id="shell.missed-routines-skip" ${busyAttr()}>Skip</button>
|
|
130
|
+
</div>`;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function manyHtml(offers) {
|
|
134
|
+
const n = state.ticked.size;
|
|
135
|
+
const all = n === offers.length;
|
|
136
|
+
const anyStarting = offers.some((o) => o.starting);
|
|
137
|
+
const aiTicked = offers.some((o) => o.ai && state.ticked.has(o.offerId));
|
|
138
|
+
const blocked = state.busy ? BUSY_REASON : n === 0 ? 'Tick the routines you want to run first.' : '';
|
|
139
|
+
const rows = offers.map((o) => `
|
|
140
|
+
<label class="missed-row">
|
|
141
|
+
<input type="checkbox" class="missed-pick" data-offer="${esc(o.offerId)}" data-command-id="shell.missed-routines-pick#${esc(o.routineId)}" data-command-instance-label="${esc(o.name)}" ${state.ticked.has(o.offerId) ? 'checked' : ''} ${busyAttr()}>
|
|
142
|
+
<span class="missed-row-main"><span class="missed-row-name">${esc(o.name)}</span>${aiPill(o)}<span class="missed-row-sub">${esc(rowSub(o))}</span></span>
|
|
143
|
+
</label>`).join('');
|
|
144
|
+
return `
|
|
145
|
+
<div class="missed-head"><span class="missed-title">${offers.length} routines missed their time</span>${laterButton()}</div>
|
|
146
|
+
<p class="missed-text">${anyStarting ? 'FloLess was closed or still starting up' : 'FloLess was closed'}, so nothing ran. Choose what to run now; each runs once.</p>
|
|
147
|
+
<div class="missed-select"><button type="button" class="rtn-link" data-missed="select-all" data-command-id="shell.missed-routines-select-all" ${busyAttr()}>${all ? 'Clear all' : 'Select all'}</button></div>
|
|
148
|
+
<div class="missed-list">${rows}</div>
|
|
149
|
+
${aiTicked ? '<p class="missed-foot">AI routines use your AI subscription.</p>' : ''}
|
|
150
|
+
<div class="missed-actions">
|
|
151
|
+
<button type="button" class="toast-action missed-primary" data-missed="run-selected" data-command-id="shell.missed-routines-run-selected"${n === 0 || state.busy ? ' disabled' : ''}${blocked ? ` data-blocked-reason="${esc(blocked)}" data-tip="${esc(blocked)}"` : ''}>Run selected (${n})</button>
|
|
152
|
+
<button type="button" class="toast-action" data-missed="skip-all" data-command-id="shell.missed-routines-skip-all" ${busyAttr()}>Skip all</button>
|
|
153
|
+
</div>`;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function onChange(event) {
|
|
157
|
+
const box = event.target.closest('.missed-pick');
|
|
158
|
+
if (!box) return;
|
|
159
|
+
if (box.checked) state.ticked.add(box.dataset.offer); else state.ticked.delete(box.dataset.offer);
|
|
160
|
+
render();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function onClick(event) {
|
|
164
|
+
const button = event.target.closest('[data-missed]');
|
|
165
|
+
if (!button || button.disabled) return;
|
|
166
|
+
const what = button.dataset.missed;
|
|
167
|
+
if (what === 'later') { for (const o of state.offers) state.later.add(o.offerId); render(); paintRoutinesNote(); return; }
|
|
168
|
+
if (what === 'select-all') {
|
|
169
|
+
if (state.ticked.size === state.offers.length) state.ticked.clear();
|
|
170
|
+
else for (const o of state.offers) state.ticked.add(o.offerId);
|
|
171
|
+
render();
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (what === 'run-one') void answer('run', [state.offers[0]]);
|
|
175
|
+
else if (what === 'skip-one') void answer('skip', [state.offers[0]]);
|
|
176
|
+
else if (what === 'run-selected') void answer('run', state.offers.filter((o) => state.ticked.has(o.offerId)));
|
|
177
|
+
else if (what === 'skip-all') void answer('skip', state.offers.slice());
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Sends the answer for each question, one by one, then says what happened in one toast per outcome. */
|
|
181
|
+
async function answer(kind, offers) {
|
|
182
|
+
const ctx = state.ctx;
|
|
183
|
+
if (!ctx || !offers.length || state.busy) return;
|
|
184
|
+
state.busy = true;
|
|
185
|
+
render();
|
|
186
|
+
const done = [];
|
|
187
|
+
const alreadyRunning = [];
|
|
188
|
+
const gone = [];
|
|
189
|
+
for (const o of offers) {
|
|
190
|
+
state.answered.add(o.offerId);
|
|
191
|
+
try {
|
|
192
|
+
if (kind === 'run') {
|
|
193
|
+
await ctx.api(`/api/routines/${encodeURIComponent(o.routineId)}/run`, { method: 'POST', body: JSON.stringify({ missedOfferId: o.offerId }) });
|
|
194
|
+
} else {
|
|
195
|
+
await ctx.api(`/api/routines/${encodeURIComponent(o.routineId)}/missed-offer/skip`, { method: 'POST', body: JSON.stringify({ expectedOfferId: o.offerId }) });
|
|
196
|
+
}
|
|
197
|
+
done.push(o.name);
|
|
198
|
+
} catch (error) {
|
|
199
|
+
if (error?.body?.running) alreadyRunning.push(o.name);
|
|
200
|
+
else if (error?.body?.code === 'no-missed-offer') gone.push(o.name);
|
|
201
|
+
else { state.answered.delete(o.offerId); ctx.reportErr(error, kind === 'run' ? `run “${o.name}”` : `skip “${o.name}”`); }
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
state.busy = false;
|
|
205
|
+
const names = (list) => list.map((name) => `“${name}”`).join(', ');
|
|
206
|
+
if (done.length) {
|
|
207
|
+
toast(kind === 'run'
|
|
208
|
+
? `${done.length === 1 ? `Started ${names(done)}` : `Started ${done.length} routines`}. How each run goes shows in Routines.`
|
|
209
|
+
: `${done.length === 1 ? `Skipped ${names(done)}` : `Skipped ${done.length} routines`}. Nothing ran; each runs at its next scheduled time.`, 'ok');
|
|
210
|
+
}
|
|
211
|
+
if (alreadyRunning.length) toast(`${names(alreadyRunning)} ${alreadyRunning.length === 1 ? 'is' : 'are'} already running, so FloLess didn’t start ${alreadyRunning.length === 1 ? 'it' : 'them'} again. ${alreadyRunning.length === 1 ? 'It is' : 'They are'} still waiting for your answer.`, 'info');
|
|
212
|
+
if (gone.length) toast(`${names(gone)} ${gone.length === 1 ? 'is' : 'are'} no longer waiting for an answer, so nothing was done for ${gone.length === 1 ? 'it' : 'them'}.`, 'info');
|
|
213
|
+
for (const name of alreadyRunning) { const o = offers.find((x) => x.name === name); if (o) state.answered.delete(o.offerId); }
|
|
214
|
+
await ctx.reload?.();
|
|
215
|
+
render();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/** Routines says what still waits for an answer, and reopens the card. */
|
|
219
|
+
function paintRoutinesNote() {
|
|
220
|
+
const note = document.getElementById('rtn-missed-note');
|
|
221
|
+
const text = document.getElementById('rtn-missed-text');
|
|
222
|
+
if (!note || !text) return;
|
|
223
|
+
const n = state.offers.length;
|
|
224
|
+
note.hidden = n === 0;
|
|
225
|
+
text.textContent = n === 1 ? '1 routine missed its time while FloLess was closed and waits for your answer.'
|
|
226
|
+
: `${n} routines missed their time while FloLess was closed and wait for your answer.`;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** Closes Routines (the card never shows over a dialog), shows the card again after Later and moves focus into it. */
|
|
230
|
+
function open() {
|
|
231
|
+
if (document.getElementById('routines-modal')?.classList.contains('show')) document.getElementById('routines-close')?.click();
|
|
232
|
+
state.later.clear();
|
|
233
|
+
render();
|
|
234
|
+
card?.querySelector('[data-missed]:not([disabled]):not(.missed-later)')?.focus();
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
document.getElementById('rtn-missed-review')?.addEventListener('click', open);
|
|
238
|
+
window.flolessMissedRoutines = { update, open };
|
|
239
|
+
})();
|