@floless/app 0.162.1 → 0.163.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 +11754 -8096
- package/dist/schemas/steel.model.v2.schema.json +16 -2
- package/dist/skills/floless-app-actions/SKILL.md +54 -3
- package/dist/skills/floless-app-onboarding/SKILL.md +2 -2
- package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +8 -6
- package/dist/skills/floless-app-report-issue/SKILL.md +12 -1
- package/dist/skills/floless-app-rfi/SKILL.md +36 -9
- package/dist/skills/floless-app-steel-model/SKILL.md +5 -3
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +39 -34
- package/dist/skills/floless-app-steel-takeoff/references/elevation-registration.md +10 -6
- package/dist/web/agents.js +24 -4
- package/dist/web/app.css +45 -7
- package/dist/web/app.js +22 -3
- package/dist/web/aware.js +157 -43
- package/dist/web/chat.css +26 -1
- package/dist/web/chat.js +32 -8
- package/dist/web/commands-shell.js +190 -4
- package/dist/web/commands-steel.js +14 -0
- package/dist/web/failure-copy.js +168 -0
- package/dist/web/index.html +35 -1
- package/dist/web/instructor.js +3 -1
- package/dist/web/landing-sort.js +277 -0
- package/dist/web/model-editor-steel-adapter.js +3 -0
- package/dist/web/model-panel-bridge.js +13 -2
- package/dist/web/model-view-query.js +23 -15
- package/dist/web/project-access.js +3 -3
- package/dist/web/project-rfis.js +250 -7
- package/dist/web/project-workflows.js +1 -1
- package/dist/web/steel-3d-view.js +8 -1
- package/dist/web/steel-editor.html +441 -12
- package/dist/web/steel-filter-core.js +2 -0
- package/dist/web/steel-filter.html +38 -5
- package/dist/web/steel-model-v2-commands.js +3 -1
- package/dist/web/steel-profile-colours.js +124 -24
- package/dist/web/workspaces.js +243 -38
- package/package.json +1 -1
package/dist/web/app.css
CHANGED
|
@@ -1940,6 +1940,14 @@
|
|
|
1940
1940
|
.project-setup-quick-terms p { margin:0; }
|
|
1941
1941
|
.project-setup-quick-terms[hidden], .project-setup-build .project-setup-note[hidden] { display:none; }
|
|
1942
1942
|
.project-setup-build button[aria-disabled="true"] { cursor:default; opacity:.55; }
|
|
1943
|
+
/* #2521 row 2c: the Drawing Filter choice, inside the Model choice while Quick is pressed: the same held toggle,
|
|
1944
|
+
its explanation above the pair so it is read before the pick. */
|
|
1945
|
+
.project-setup-filter { display:grid; gap:6px; }
|
|
1946
|
+
.project-setup-filter p { margin:0; color:var(--text-muted); font-size:11px; line-height:1.5; }
|
|
1947
|
+
.project-setup-filter[hidden] { display:none; }
|
|
1948
|
+
/* Revision 3: who approves what the read leaves out, nested under "Let the AI choose" (shown only while it is pressed). */
|
|
1949
|
+
.project-setup-exclusions { display:grid; gap:6px; margin-top:4px; padding-left:10px; border-left:2px solid var(--border); }
|
|
1950
|
+
.project-setup-exclusions[hidden] { display:none; }
|
|
1943
1951
|
/* #2521 row 7b: the same Model choice when drawings are read into an existing Steel model project: the confirm step
|
|
1944
1952
|
after the file picker, and inline in the Knowledge read panel (compact: labels only, trade-offs in data-tip). */
|
|
1945
1953
|
.rb-dialog { width:min(520px, calc(100vw - 32px)); }
|
|
@@ -6335,10 +6343,26 @@ body.mode-workspaces #menu .menu-item[data-action="bake"] { display:none; }
|
|
|
6335
6343
|
linear-gradient(45deg, transparent calc(50% - .75px), currentColor calc(50% - .75px) calc(50% + .75px), transparent calc(50% + .75px)),
|
|
6336
6344
|
linear-gradient(-45deg, transparent calc(50% - .75px), currentColor calc(50% - .75px) calc(50% + .75px), transparent calc(50% + .75px)); }
|
|
6337
6345
|
.ws-landing-search::-webkit-search-cancel-button:hover { color:var(--text); }
|
|
6346
|
+
/* #2866: Sort by — the workflow picker's combobox (.wf-combo/.wf-trigger/.wf-popover) and a ghost direction button,
|
|
6347
|
+
sized to the search box beside them. Fixed minimum widths so "A–Z" ↔ "Oldest first" never shifts the header. */
|
|
6348
|
+
.ls-sort { display:inline-flex; align-items:center; gap:6px; flex:none; }
|
|
6349
|
+
.ls-sort .wf-combo { min-width:0; flex:none; }
|
|
6350
|
+
.ls-sort .wf-trigger { width:auto; min-width:156px; border-radius:6px; padding:6px 10px; background:var(--surface);
|
|
6351
|
+
line-height:normal; gap:6px; }
|
|
6352
|
+
.ls-sort .wf-trigger:focus-visible { outline:none; border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-soft); }
|
|
6353
|
+
.ls-sort-prefix { color:var(--text-muted); flex:none; }
|
|
6354
|
+
.ls-sort-popover { left:auto; right:0; }
|
|
6355
|
+
.ls-sort-dir { display:inline-flex; align-items:center; justify-content:center; gap:6px; min-width:116px; }
|
|
6356
|
+
.ls-sort-arrow { line-height:1; }
|
|
6357
|
+
/* The quiet note on a section heading while a date sort leaves some cards undated. */
|
|
6358
|
+
.ls-undated { color:var(--text-dim); font-weight:400; font-size:11px; letter-spacing:0; text-transform:none; margin-left:4px; }
|
|
6338
6359
|
@media (max-width:760px) {
|
|
6339
6360
|
.ws-head { align-items:stretch; }
|
|
6340
6361
|
.ws-head-actions { flex-direction:column; align-items:stretch; }
|
|
6341
6362
|
.ws-landing-search { width:100%; }
|
|
6363
|
+
.ls-sort { display:flex; width:100%; }
|
|
6364
|
+
.ls-sort .wf-combo { flex:1 1 auto; }
|
|
6365
|
+
.ls-sort .wf-trigger { width:100%; }
|
|
6342
6366
|
}
|
|
6343
6367
|
/* ONE track definition for both landing grids, so a create card and the project cards below it sit in
|
|
6344
6368
|
the same columns. They had two: create was `auto-fit minmax(220px,260px)` (capped) while projects
|
|
@@ -6769,14 +6793,23 @@ body.mode-workspaces #menu .menu-item[data-action="bake"] { display:none; }
|
|
|
6769
6793
|
.wsg-head { display:flex; align-items:center; gap:8px; min-width:0; }
|
|
6770
6794
|
.wsg-toolbar { float:right; margin:0 0 4px 10px; }
|
|
6771
6795
|
.wsg-compact { display:none; }
|
|
6772
|
-
|
|
6773
|
-
|
|
6774
|
-
|
|
6775
|
-
.wsg-toggle
|
|
6776
|
-
|
|
6796
|
+
/* #2867: a ghost chevron button, the chat cards' disclosure (open points down, folded points right), on
|
|
6797
|
+
the shared panel-toggle artwork. It stays top-right in both states so the target never jumps; the
|
|
6798
|
+
22px box is offset by negative margins so it does not make the strip taller than the old text pill. */
|
|
6799
|
+
.wsg-toggle { position:relative; flex:none; display:grid; place-items:center; width:22px; height:22px; margin:-3px -4px -3px 0;
|
|
6800
|
+
padding:0; border:1px solid transparent; border-radius:5px; background:var(--surface-2); color:var(--text-muted); cursor:pointer;
|
|
6801
|
+
transition:color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
|
|
6802
|
+
.wsg-toggle::before { content:""; position:absolute; inset:-1px; }
|
|
6803
|
+
.wsg-toggle svg { width:13px; height:13px; display:block; fill:none; stroke:currentColor; stroke-width:1.8;
|
|
6804
|
+
stroke-linecap:round; stroke-linejoin:round; transform:rotate(90deg); transition:transform var(--dur) var(--ease); }
|
|
6805
|
+
.wsg-toggle[aria-expanded="false"] svg { transform:none; }
|
|
6806
|
+
.wsg-toggle:hover { color:var(--text); background:var(--surface-3); }
|
|
6807
|
+
.wsg-toggle:focus-visible { outline:2px solid var(--accent); outline-offset:1px; }
|
|
6808
|
+
@media (prefers-reduced-motion: reduce) { .wsg-toggle, .wsg-toggle svg { transition:none; } }
|
|
6809
|
+
/* The folded line keeps the open strip's scrollbar gutter, so the chevron sits at the same x in both states. */
|
|
6810
|
+
.ws-stage-guidance.is-collapsed { overflow:hidden; }
|
|
6777
6811
|
.ws-stage-guidance.is-collapsed > :not(.wsg-toolbar) { display:none; }
|
|
6778
|
-
.ws-stage-guidance.is-collapsed .wsg-toolbar { float:none; display:flex; align-items:center; gap:10px; margin:0; min-width:0; }
|
|
6779
|
-
.ws-stage-guidance.is-collapsed .wsg-compact { display:block; flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
|
6812
|
+
.ws-stage-guidance.is-collapsed .wsg-toolbar { float:none; display:flex; align-items:center; gap:10px; margin:0; min-width:0; }.ws-stage-guidance.is-collapsed .wsg-compact { display:block; flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
|
6780
6813
|
.wsg-compact strong { color:var(--text); font-weight:600; }
|
|
6781
6814
|
.wsg-compact-label { color:var(--accent-bright); font-weight:600; }
|
|
6782
6815
|
.state-waiting .wsg-compact-label { color:var(--warn); }
|
|
@@ -7280,6 +7313,9 @@ table.hist tr.current td { background:var(--accent-soft); }
|
|
|
7280
7313
|
.ws-revision-card[hidden] { display:none !important; }
|
|
7281
7314
|
.ws-revision-card b { color:var(--text); font-weight:600; }
|
|
7282
7315
|
.ws-revision-card .wrc-text { flex:1; min-width:0; }
|
|
7316
|
+
/* #2521 row 2c: the "AI's choice" mark on a Drawing Filter the AI chose; focusable so its data-tip reaches the keyboard. */
|
|
7317
|
+
.ws-revision-card .wrc-ai-pill { flex:none; margin-left:0; }
|
|
7318
|
+
.wrc-ai-pill:focus-visible, .wsg-ai-pill:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
|
|
7283
7319
|
.ws-revision-card .wrc-dot { flex:none; width:8px; height:8px; border-radius:50%; background:var(--text-dim); }
|
|
7284
7320
|
.ws-revision-card.state-failed { border-left:3px solid var(--err); }
|
|
7285
7321
|
.ws-revision-card.state-failed .wrc-err-ico { color:var(--err); flex:none; }
|
|
@@ -8320,6 +8356,8 @@ body.mode-agents #menu .menu-item[data-action="bake"] { display:none; }
|
|
|
8320
8356
|
/* Light theme: --text-muted on the row's surface is 4.34:1 at 12px (independent QA), below AA — use the body text there. */
|
|
8321
8357
|
[data-theme="light"] .ws-rfis [data-pr-delivery-note], [data-theme="light"] .ws-rfis .pr-readiness { color:var(--text); }
|
|
8322
8358
|
.ws-rfis .pr-delivery-held { color:var(--text); }
|
|
8359
|
+
/* #2470 R6.6e: the sends FloLess couldn't confirm, listed under their disclosure. */
|
|
8360
|
+
.ws-rfis .pr-settled { margin:4px 0 0; padding-left:18px; display:grid; gap:2px; }
|
|
8323
8361
|
.ws-rfis [data-pr-delivery-note]:focus-visible { outline:2px solid var(--accent); outline-offset:2px; border-radius:3px; }
|
|
8324
8362
|
.pr-radios { display:flex; flex-direction:column; gap:4px; }
|
|
8325
8363
|
.pr-radio { display:flex; align-items:flex-start; gap:8px; text-align:left; padding:5px 8px; border:1px solid transparent; border-radius:5px; background:transparent; color:var(--text); cursor:pointer; }
|
package/dist/web/app.js
CHANGED
|
@@ -1685,14 +1685,18 @@ if (!fullscreenSupported()) {
|
|
|
1685
1685
|
// names their own folders and projects, and a project called "Null Street Bridge" or a folder called
|
|
1686
1686
|
// "Exception tower" is not a diagnostic — replacing that sentence with "lost contact" would be untrue.
|
|
1687
1687
|
function userSafeToastMessage(msg, type) {
|
|
1688
|
+
// Declared inside: several test harnesses lift this function alone.
|
|
1689
|
+
const UNKNOWN_FAILURE_TOAST = 'Something went wrong, and FloLess couldn’t tell why. Try once more. If it happens again, use Report an issue at the bottom of the window.';
|
|
1688
1690
|
const authored = msg && typeof msg === 'object' ? msg[Symbol.for('floless.authored-toast-copy')] : undefined;
|
|
1689
|
-
if (typeof authored === 'string') return authored.trim() ||
|
|
1691
|
+
if (typeof authored === 'string') return authored.trim() || UNKNOWN_FAILURE_TOAST;
|
|
1690
1692
|
const text = String(msg ?? '').trim();
|
|
1693
|
+
// #2868: the reason behind raw text is unknown, so this says so. It used to blame a lost connection and promise the
|
|
1694
|
+
// work was still there, neither of which this line can know.
|
|
1691
1695
|
if ((type === 'warn' || type === 'err')
|
|
1692
1696
|
&& /\b(?:http\s*\d+|error:|exception|stack trace|server log|status code|undefined|null|subscription required|unauthori[sz]ed|forbidden)\b/i.test(text)) {
|
|
1693
|
-
return
|
|
1697
|
+
return UNKNOWN_FAILURE_TOAST;
|
|
1694
1698
|
}
|
|
1695
|
-
return text ||
|
|
1699
|
+
return text || UNKNOWN_FAILURE_TOAST;
|
|
1696
1700
|
}
|
|
1697
1701
|
|
|
1698
1702
|
/**
|
|
@@ -1757,6 +1761,21 @@ function showToast(msg, type, options) {
|
|
|
1757
1761
|
return dismiss;
|
|
1758
1762
|
}
|
|
1759
1763
|
|
|
1764
|
+
// #2868: a failed request, in the person's words (web/failure-copy.js says what happened, why and what to do next).
|
|
1765
|
+
// Pressing the same thing again while it is still refused replaces the earlier toast instead of stacking a copy, so the
|
|
1766
|
+
// live region announces it once more rather than piling up. A lost connection while the offline overlay is up says
|
|
1767
|
+
// nothing: the overlay already says FloLess stopped answering, and a toast under it would only repeat that.
|
|
1768
|
+
const failureToastShown = new Map();
|
|
1769
|
+
function showFailureToast(error, ctx) {
|
|
1770
|
+
const account = globalThis.flolessBridge?.accountAccessText;
|
|
1771
|
+
const copy = failureCopy(error, { ...(ctx || {}), account: (ctx && ctx.account) || account });
|
|
1772
|
+
if (copy.kind === 'connection' && document.getElementById('server-offline-overlay')) return copy;
|
|
1773
|
+
failureToastShown.get(copy.text)?.(true); // dismiss is idempotent, so an already-closed toast is a no-op
|
|
1774
|
+
if (failureToastShown.size > 50) failureToastShown.clear();
|
|
1775
|
+
failureToastShown.set(copy.text, showToast(copy.text, copy.type));
|
|
1776
|
+
return copy;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1760
1779
|
/* ============= ZOOM + PAN ============= */
|
|
1761
1780
|
|
|
1762
1781
|
const ZOOM_LEVELS = [0.5, 0.6, 0.75, 0.85, 1.0, 1.15, 1.3, 1.5, 1.75, 2.0];
|
package/dist/web/aware.js
CHANGED
|
@@ -1703,8 +1703,9 @@
|
|
|
1703
1703
|
.map((project) => ({
|
|
1704
1704
|
value: `project:${project.id}`,
|
|
1705
1705
|
label: project.name || project.id,
|
|
1706
|
-
// #2470 R6.2:
|
|
1707
|
-
|
|
1706
|
+
// #2470 R6.2/R6.2b: every project kind is named as the person sees it ("General project", "Trace project"), never by
|
|
1707
|
+
// FloLess's type id. workspaces.js owns the names; a kind it does not know reads "Workspace project".
|
|
1708
|
+
meta: `${window.flolessWorkspaces?.kindLabelOf?.(project) || 'Workspace'} project`,
|
|
1708
1709
|
})),
|
|
1709
1710
|
];
|
|
1710
1711
|
}
|
|
@@ -2552,7 +2553,7 @@
|
|
|
2552
2553
|
});
|
|
2553
2554
|
await loadApps();
|
|
2554
2555
|
showToast(`Renamed to “${workflow.displayName}”`, 'ok');
|
|
2555
|
-
} catch (e) { reportErr(e); }
|
|
2556
|
+
} catch (e) { reportErr(e, 'rename this workflow'); }
|
|
2556
2557
|
}
|
|
2557
2558
|
|
|
2558
2559
|
async function copyOwnedWorkflow(workflowId, oldName) {
|
|
@@ -2593,7 +2594,7 @@
|
|
|
2593
2594
|
}),
|
|
2594
2595
|
});
|
|
2595
2596
|
showToast(`Copied as “${workflow.displayName}”`, 'ok');
|
|
2596
|
-
} catch (e) { reportErr(e); }
|
|
2597
|
+
} catch (e) { reportErr(e, 'copy this workflow'); }
|
|
2597
2598
|
}
|
|
2598
2599
|
|
|
2599
2600
|
async function archiveOwnedWorkflow(workflowId, name) {
|
|
@@ -2612,7 +2613,7 @@
|
|
|
2612
2613
|
await loadApps();
|
|
2613
2614
|
// An open draft already said so when the refresh closed it (resolveOpenDraft) — one message, not two.
|
|
2614
2615
|
if (!(wasOpenDraft && !draftWorkflow)) showToast(`Archived “${name}”`, 'ok');
|
|
2615
|
-
} catch (e) { reportErr(e); }
|
|
2616
|
+
} catch (e) { reportErr(e, 'archive this workflow'); }
|
|
2616
2617
|
}
|
|
2617
2618
|
|
|
2618
2619
|
/**
|
|
@@ -6816,6 +6817,7 @@
|
|
|
6816
6817
|
*/
|
|
6817
6818
|
async function publishOwnedFromHeader(id, workflowId) {
|
|
6818
6819
|
const name = workflowLabelOf(id);
|
|
6820
|
+
const chatAtStart = chatOwnerKey();
|
|
6819
6821
|
$compileBtn.disabled = true;
|
|
6820
6822
|
const prev = $compileBtn.textContent;
|
|
6821
6823
|
$compileBtn.textContent = '⎙ Compiling…';
|
|
@@ -6828,11 +6830,17 @@
|
|
|
6828
6830
|
restore();
|
|
6829
6831
|
const ask = globalThis.flolessStepRename ? globalThis.flolessStepRename.askOf(e) : null;
|
|
6830
6832
|
if (ask) { await renameStepThenCompile(id, ask); return; }
|
|
6831
|
-
// The publish route's own refusal is a sentence for the person; anything else is reported as usual.
|
|
6832
|
-
|
|
6833
|
-
|
|
6833
|
+
// The publish route's own refusal is a sentence for the person; anything else is reported as usual. #2764: it stays
|
|
6834
|
+
// until closed, in the Compile slot, and hands AWARE's reason to the AI from its Ask AI to fix.
|
|
6835
|
+
if (e?.body?.code === 'workflow-compile-failed' && typeof e.body.error === 'string') {
|
|
6836
|
+
showCompileRefusal(e.body.error, name, e.body, chatAtStart);
|
|
6837
|
+
return;
|
|
6838
|
+
}
|
|
6839
|
+
reportErr(e, 'compile this workflow');
|
|
6834
6840
|
return;
|
|
6835
6841
|
}
|
|
6842
|
+
// #2764: published, so a refusal still on screen from an earlier Compile is out of date, whichever answer follows.
|
|
6843
|
+
standingToast('compile');
|
|
6836
6844
|
const notOpened = `${name} is compiled. FloLess couldn’t open the new version — open it from the Workflows page.`;
|
|
6837
6845
|
// Only the publish answer names the new version: never fall back to the old copy, which would show the old steps as current.
|
|
6838
6846
|
if (!newId) { restore(); showToast(notOpened, 'warn'); return; }
|
|
@@ -6859,10 +6867,26 @@
|
|
|
6859
6867
|
|
|
6860
6868
|
// One outcome per surface (a run, a compile): the next one replaces it, so repeats never pile up. Outcomes that need the
|
|
6861
6869
|
// person stay until closed; a plain "complete" goes by itself (persistent = false).
|
|
6870
|
+
// #2764: a `chatBound` outcome belongs to the AI Chat conversation open when it was shown (a refused compile's Ask AI to
|
|
6871
|
+
// fix writes there), so it closes when AI Chat moves to another conversation.
|
|
6862
6872
|
const standingToasts = new Map();
|
|
6863
|
-
|
|
6873
|
+
const standingChatOwners = new Map();
|
|
6874
|
+
function standingToast(surface, text, type, persistent = true, action = null, chatBound = false) {
|
|
6864
6875
|
standingToasts.get(surface)?.(true);
|
|
6865
|
-
|
|
6876
|
+
const options = persistent || action ? { ...(persistent ? { persistent: true } : {}), ...(action ? { action } : {}) } : undefined;
|
|
6877
|
+
standingToasts.set(surface, text ? showToast(text, type, options) : null);
|
|
6878
|
+
standingChatOwners.set(surface, text && chatBound ? chatOwnerKey() : null);
|
|
6879
|
+
}
|
|
6880
|
+
window.addEventListener('floless:chat-scope-changed', () => {
|
|
6881
|
+
for (const [surface, owner] of standingChatOwners) if (owner && owner !== chatOwnerKey()) standingToast(surface);
|
|
6882
|
+
});
|
|
6883
|
+
|
|
6884
|
+
/** Which AI Chat conversation the open view uses, told apart as AI Chat tells them apart (its owner), or ''. */
|
|
6885
|
+
function chatOwnerKey() {
|
|
6886
|
+
const owner = currentChatScope()?.owner;
|
|
6887
|
+
if (!owner) return '';
|
|
6888
|
+
const id = owner.kind === 'project' ? owner.projectId : owner.kind === 'workflow' ? owner.workflowId : 'workspace';
|
|
6889
|
+
return typeof id === 'string' ? `${owner.kind}:${id}` : '';
|
|
6866
6890
|
}
|
|
6867
6891
|
|
|
6868
6892
|
/** After a Compile: a workflow that still cannot run says why, and where to look. */
|
|
@@ -6879,6 +6903,7 @@
|
|
|
6879
6903
|
const id = currentId;
|
|
6880
6904
|
const ownedId = ownedWorkflowOf(id)?.ownedWorkflow?.workflowId || null;
|
|
6881
6905
|
if (ownedId) { await publishOwnedFromHeader(id, ownedId); return; }
|
|
6906
|
+
const chatAtStart = chatOwnerKey();
|
|
6882
6907
|
// #2241 S4: a workflow with an AI step nobody has confirmed (or that changed) is approved from the confirmation dialog, which
|
|
6883
6908
|
// records the tick and approves the exact bytes it showed. 'proceed' = nothing to ask, the normal compile goes on.
|
|
6884
6909
|
const consent = globalThis.flolessAgentSteps ? await globalThis.flolessAgentSteps.confirmBeforeApprove(apps.get(id) || { id }) : 'proceed';
|
|
@@ -6898,10 +6923,10 @@
|
|
|
6898
6923
|
$compileBtn.disabled = false;
|
|
6899
6924
|
const ask = globalThis.flolessStepRename ? globalThis.flolessStepRename.askOf(e) : null;
|
|
6900
6925
|
if (ask) { await renameStepThenCompile(id, ask); return; }
|
|
6901
|
-
// #2740: in the Compile slot, so a second refusal replaces the first and a later clean compile clears it.
|
|
6926
|
+
// #2740, #2764: in the Compile slot, so a second refusal replaces the first and a later clean compile clears it.
|
|
6902
6927
|
const refused = compileRefusalText(e);
|
|
6903
|
-
if (refused) {
|
|
6904
|
-
reportErr(e);
|
|
6928
|
+
if (refused) { showCompileRefusal(refused, workflowLabelOf(id), e.body, chatAtStart); return; }
|
|
6929
|
+
reportErr(e, 'compile this workflow');
|
|
6905
6930
|
}
|
|
6906
6931
|
}
|
|
6907
6932
|
$compileBtn.onclick = () => compileCurrentWorkflow();
|
|
@@ -11214,9 +11239,65 @@
|
|
|
11214
11239
|
return e?.body?.ok === false && e.body.code === 'workflow-compile-refused' && typeof e.body.userMessage === 'string' ? e.body.userMessage.trim() : '';
|
|
11215
11240
|
}
|
|
11216
11241
|
|
|
11217
|
-
|
|
11242
|
+
/**
|
|
11243
|
+
* #2764: what "Ask AI to fix" writes into AI Chat after AWARE refused to compile a workflow. The person's sentence never
|
|
11244
|
+
* quotes AWARE (its reason is written for a terminal); the AI gets AWARE's code and reason as AWARE printed them.
|
|
11245
|
+
*/
|
|
11246
|
+
function compileRefusalDraft(name, body) {
|
|
11247
|
+
const what = name ? `the workflow "${name}"` : 'this workflow';
|
|
11248
|
+
const reason = typeof body?.reason === 'string' ? body.reason.trim() : '';
|
|
11249
|
+
const code = typeof body?.awareCode === 'string' && body.awareCode ? ` (${body.awareCode})` : '';
|
|
11250
|
+
return `FloLess couldn’t compile ${what}.\n${reason ? `AWARE’s reason${code}: ${reason}\n` : ''}`
|
|
11251
|
+
+ 'Please fix the workflow file so it compiles, and tell me what you changed. Don’t compile or approve it for me.';
|
|
11252
|
+
}
|
|
11253
|
+
|
|
11254
|
+
/**
|
|
11255
|
+
* The toast's "Ask AI to fix" for a refused compile: it writes the request into AI Chat for the person to send. The
|
|
11256
|
+
* toast closes on the click, so when AI Chat cannot take the request the refusal's sentence comes back with the reason,
|
|
11257
|
+
* and stays until closed. The request belongs in the AI Chat conversation that was open when the refusal was shown:
|
|
11258
|
+
* the toast carrying it closes when AI Chat moves to another conversation (`standingToast`'s `chatBound`), and AI Chat
|
|
11259
|
+
* refuses the request if it has moved while the request was on its way (`openDraft`'s `ownerKey`).
|
|
11260
|
+
*/
|
|
11261
|
+
function compileRefusalAskAi(name, body) {
|
|
11262
|
+
const ownerKey = chatOwnerKey();
|
|
11263
|
+
return { label: 'Ask AI to fix', commandId: 'shell.compile-refusal-ask-ai', onClick: () => {
|
|
11264
|
+
const said = typeof body?.userMessage === 'string' ? body.userMessage.trim() : typeof body?.error === 'string' ? body.error.trim() : '';
|
|
11265
|
+
const notTaken = (why) => showToast(authoredToastCopy(`${said ? `${said} ` : ''}${why}`), 'warn', { persistent: true });
|
|
11266
|
+
const open = window.flolessChat?.openDraft;
|
|
11267
|
+
if (typeof open !== 'function') { notTaken('AI Chat is still starting. Ask it to fix the workflow in a moment.'); return; }
|
|
11268
|
+
if (chatOwnerKey() !== ownerKey) { notTaken(`Open ${name ? `“${name}”` : 'that workflow'} again, then ask its AI Chat to fix the workflow.`); return; }
|
|
11269
|
+
Promise.resolve(open(compileRefusalDraft(name, body), { ownerKey }))
|
|
11270
|
+
.catch(() => { notTaken('AI Chat couldn’t open here. Open this workflow’s chat and ask it to fix the workflow.'); });
|
|
11271
|
+
} };
|
|
11272
|
+
}
|
|
11273
|
+
|
|
11274
|
+
/**
|
|
11275
|
+
* #2764: a refused compile, in the Compile slot. `chatAtStart` is the AI Chat conversation open when Compile was
|
|
11276
|
+
* pressed: if the person has moved on before the answer came, the refusal is still said, under the workflow's name,
|
|
11277
|
+
* but with no Ask AI to fix, which would write into a conversation that is not that workflow's.
|
|
11278
|
+
*/
|
|
11279
|
+
function showCompileRefusal(text, name, body, chatAtStart = null) {
|
|
11280
|
+
if (chatAtStart !== null && chatAtStart !== chatOwnerKey()) {
|
|
11281
|
+
standingToast('compile', authoredToastCopy(`${name ? `${name}: ` : ''}${text}`), 'warn');
|
|
11282
|
+
return;
|
|
11283
|
+
}
|
|
11284
|
+
standingToast('compile', authoredToastCopy(text), 'warn', true, compileRefusalAskAi(name, body), true);
|
|
11285
|
+
}
|
|
11286
|
+
|
|
11287
|
+
/**
|
|
11288
|
+
* The Workflows surface's catch-all for a failed request. `action` completes "Couldn't …" ("compile this workflow") so
|
|
11289
|
+
* the sentence names what the person pressed; without it the sentence says "finish that". Known refusals say their own
|
|
11290
|
+
* sentence first; everything else goes through the shared failure copy (#2868, web/failure-copy.js), which names a
|
|
11291
|
+
* busy holder, a stale screen, a lost connection or a sign-in instead of "try again, reopen FloLess". `opts.retrySafe`
|
|
11292
|
+
* marks an action that only reads, so an unexplained failure may suggest trying once more.
|
|
11293
|
+
*/
|
|
11294
|
+
function reportErr(e, action, opts) {
|
|
11218
11295
|
if (awarePageUnloading && e instanceof TypeError && e.message === 'Failed to fetch') return;
|
|
11219
|
-
|
|
11296
|
+
// #2868: a refusal FloLess expects (busy, changed elsewhere, signed out) is not a fault, so it is noted, not logged as
|
|
11297
|
+
// an error; a lost connection or an unknown failure still is, for diagnosis.
|
|
11298
|
+
const expected = typeof failureKind === 'function' && ['busy', 'stale', 'access'].includes(failureKind(e));
|
|
11299
|
+
if (expected) console.warn('[workflows] refused:', e?.body?.code || e?.status, e?.message);
|
|
11300
|
+
else console.error(e);
|
|
11220
11301
|
const refusal = moduleRefusalText(e);
|
|
11221
11302
|
if (refusal) {
|
|
11222
11303
|
showToast(refusal, 'warn');
|
|
@@ -11232,10 +11313,10 @@
|
|
|
11232
11313
|
// that, so the person reads AWARE's reason and the choices, and it stays until they close it.
|
|
11233
11314
|
const refused = compileRefusalText(e);
|
|
11234
11315
|
if (refused) {
|
|
11235
|
-
|
|
11316
|
+
showCompileRefusal(refused, null, e.body);
|
|
11236
11317
|
return;
|
|
11237
11318
|
}
|
|
11238
|
-
|
|
11319
|
+
showFailureToast(e, { action: typeof action === 'string' && action ? action : undefined, retrySafe: !!opts?.retrySafe });
|
|
11239
11320
|
}
|
|
11240
11321
|
|
|
11241
11322
|
// True if `id` appears as a full path segment (avoids `foo` matching `foo-bar`).
|
|
@@ -11326,7 +11407,7 @@
|
|
|
11326
11407
|
state.editingTemplateId = null;
|
|
11327
11408
|
await loadTemplates();
|
|
11328
11409
|
showToast(`Updated template "${name}"`, 'ok');
|
|
11329
|
-
} catch (e) { reportErr(e); }
|
|
11410
|
+
} catch (e) { reportErr(e, 'save this template'); }
|
|
11330
11411
|
return;
|
|
11331
11412
|
}
|
|
11332
11413
|
const nodeId = state.pendingFavAgentId;
|
|
@@ -11348,12 +11429,12 @@
|
|
|
11348
11429
|
state.pendingFavAgentId = null;
|
|
11349
11430
|
await loadTemplates();
|
|
11350
11431
|
showToast(`Saved template "${name}"`, 'ok');
|
|
11351
|
-
} catch (e) { reportErr(e); }
|
|
11432
|
+
} catch (e) { reportErr(e, 'save this template'); }
|
|
11352
11433
|
};
|
|
11353
11434
|
|
|
11354
11435
|
async function deleteTemplate(id) {
|
|
11355
11436
|
try { await api(`/api/templates/${encodeURIComponent(id)}`, { method: 'DELETE' }); await loadTemplates(); }
|
|
11356
|
-
catch (e) { reportErr(e); }
|
|
11437
|
+
catch (e) { reportErr(e, 'delete this template'); }
|
|
11357
11438
|
}
|
|
11358
11439
|
|
|
11359
11440
|
async function requestKnowledgeConsult() {
|
|
@@ -12668,7 +12749,7 @@
|
|
|
12668
12749
|
const copied = await copyToClipboard(line);
|
|
12669
12750
|
showToast(copied ? 'Queued for your terminal AI · copied to clipboard' : 'Queued for your terminal AI', 'ok');
|
|
12670
12751
|
loadRequests();
|
|
12671
|
-
} catch (e) { reportErr(e); }
|
|
12752
|
+
} catch (e) { reportErr(e, 'use this template'); }
|
|
12672
12753
|
}
|
|
12673
12754
|
|
|
12674
12755
|
async function tweakNode() {
|
|
@@ -12694,7 +12775,7 @@
|
|
|
12694
12775
|
: copied ? 'Tweak queued + copied' : 'Tweak queued';
|
|
12695
12776
|
showToast(toastMsg, 'ok');
|
|
12696
12777
|
loadRequests();
|
|
12697
|
-
} catch (e) { reportErr(e); }
|
|
12778
|
+
} catch (e) { reportErr(e, 'send this tweak'); }
|
|
12698
12779
|
}
|
|
12699
12780
|
|
|
12700
12781
|
let pendingRequests = [];
|
|
@@ -14609,7 +14690,7 @@
|
|
|
14609
14690
|
|
|
14610
14691
|
async function deleteOneRequest(id) {
|
|
14611
14692
|
try { await api(`/api/requests/${encodeURIComponent(id)}`, { method: 'DELETE' }); await loadRequests(); renderRequests(); }
|
|
14612
|
-
catch (e) { reportErr(e); }
|
|
14693
|
+
catch (e) { reportErr(e, 'delete this request'); }
|
|
14613
14694
|
}
|
|
14614
14695
|
// Clear-all must never take out a knowledge-organize: the bulk DELETE would 404 its finish/fail and
|
|
14615
14696
|
// strand the organize lock until the stale timeout. The request list can't tell "queued" from
|
|
@@ -14657,7 +14738,7 @@
|
|
|
14657
14738
|
: `Cleared ${drop.length} request${drop.length === 1 ? '' : 's'} shown here`,
|
|
14658
14739
|
keep.length ? 'info' : 'ok',
|
|
14659
14740
|
);
|
|
14660
|
-
} catch (e) { reportErr(e); }
|
|
14741
|
+
} catch (e) { reportErr(e, 'clear these requests'); }
|
|
14661
14742
|
}
|
|
14662
14743
|
// Switch the scope tab (or the empty state's "Show all") and repaint.
|
|
14663
14744
|
function setRequestScopeAll(all) {
|
|
@@ -15185,7 +15266,7 @@
|
|
|
15185
15266
|
recordAgentInstallResult({ id, appId, sourceHash, ok: false, error: e.message || 'Please try again.' });
|
|
15186
15267
|
refreshAgentNotes();
|
|
15187
15268
|
if ($libModal && $libModal.classList.contains('show')) renderAvailable();
|
|
15188
|
-
reportErr(e);
|
|
15269
|
+
reportErr(e, 'install this tool');
|
|
15189
15270
|
});
|
|
15190
15271
|
}
|
|
15191
15272
|
|
|
@@ -15214,7 +15295,7 @@
|
|
|
15214
15295
|
installingIds.delete(id);
|
|
15215
15296
|
if ($libModal && $libModal.classList.contains('show')) renderLibrary();
|
|
15216
15297
|
if (onStartError) { try { onStartError(e); } catch { /* the caller's chrome, not ours */ } }
|
|
15217
|
-
reportErr(e);
|
|
15298
|
+
reportErr(e, 'update this tool');
|
|
15218
15299
|
});
|
|
15219
15300
|
}
|
|
15220
15301
|
|
|
@@ -17400,7 +17481,7 @@
|
|
|
17400
17481
|
async function toggleRoutine(id, enabled) {
|
|
17401
17482
|
try {
|
|
17402
17483
|
await api(`/api/routines/${encodeURIComponent(id)}`, { method: 'PATCH', body: JSON.stringify({ enabled }) });
|
|
17403
|
-
} catch (e) { reportErr(e); }
|
|
17484
|
+
} catch (e) { reportErr(e, 'change this routine'); }
|
|
17404
17485
|
loadRoutinesData();
|
|
17405
17486
|
}
|
|
17406
17487
|
async function runRoutineNow(id) {
|
|
@@ -17416,7 +17497,7 @@
|
|
|
17416
17497
|
// and nothing was started, so never say it was. Keyed on the FLAG rather than the status: this
|
|
17417
17498
|
// route is lifecycle-gated, so a 409 can also mean "aware is busy with maintenance", which is a
|
|
17418
17499
|
// different sentence and belongs in the error path.
|
|
17419
|
-
if (!(e.body && e.body.running)) { reportErr(e); return; }
|
|
17500
|
+
if (!(e.body && e.body.running)) { reportErr(e, 'run this routine now'); return; }
|
|
17420
17501
|
showToast(RTN_ALREADY_RUNNING, 'info');
|
|
17421
17502
|
// RECONCILE rather than add: the 409 is a point-in-time snapshot, and the run can end while the
|
|
17422
17503
|
// response is in flight. Adding the id locally would then re-assert a run that the
|
|
@@ -17460,7 +17541,7 @@
|
|
|
17460
17541
|
await api(`/api/routines/${encodeURIComponent(id)}`, { method: 'DELETE' });
|
|
17461
17542
|
await loadRoutinesData();
|
|
17462
17543
|
showToast('Routine deleted', 'ok');
|
|
17463
|
-
} catch (e) { reportErr(e); }
|
|
17544
|
+
} catch (e) { reportErr(e, 'delete this routine'); }
|
|
17464
17545
|
}
|
|
17465
17546
|
|
|
17466
17547
|
/** #2035: what the routine runs — a workflow, or an agent (always on a schedule, no inputs). */
|
|
@@ -18961,7 +19042,7 @@
|
|
|
18961
19042
|
? { ...item, restoreRefreshState: 'failed' } : item);
|
|
18962
19043
|
showToast(`Restored “${row.displayName}”. The list could not refresh. Reload this page to show it.`, 'warn');
|
|
18963
19044
|
} else showToast(`Restored “${row.displayName}”`, 'ok');
|
|
18964
|
-
} catch (error) { reportErr(error); }
|
|
19045
|
+
} catch (error) { reportErr(error, 'restore this workflow'); }
|
|
18965
19046
|
finally {
|
|
18966
19047
|
restoringWorkflows.delete(workflowId);
|
|
18967
19048
|
document.removeEventListener('focusin', trackFocus);
|
|
@@ -18985,6 +19066,8 @@
|
|
|
18985
19066
|
// The Workflows tab's home, the counterpart of the Workspaces landing: a create card and one card per workflow. It
|
|
18986
19067
|
// renders AWARE's library listing; it composes nothing.
|
|
18987
19068
|
const $wfLanding = document.getElementById('wf-landing');
|
|
19069
|
+
// #2866: a changed Sort by choice repaints the Workflows tab (the render keeps search, focus and open sections).
|
|
19070
|
+
globalThis.flolessLandingSort?.onChange('workflows', () => { if (wfLanding) renderWorkflowsLanding(); });
|
|
18988
19071
|
// The landing search's query, kept outside the input because the landing re-renders with innerHTML.
|
|
18989
19072
|
let wfLandingQuery = '';
|
|
18990
19073
|
// #2568: the landing's tabs (History: every run, grouped per workflow). The choice is remembered by this browser window;
|
|
@@ -19050,7 +19133,9 @@
|
|
|
19050
19133
|
return `<div class="ws-head"><div class="ws-head-text"><h2 tabindex="-1" id="wf-landing-title">Workflows</h2>`
|
|
19051
19134
|
+ `<p class="ws-sub">Build, run and manage the workflows behind your projects. Ask AI Chat on the left to build one with you.</p>`
|
|
19052
19135
|
+ `<div class="tabs ws-step-tabs wf-landing-tabs" role="tablist" aria-label="Workflows page">${tab('workflows', 'Workflows')}${tab('pages', 'Pages')}${tab('history', 'History')}</div></div>`
|
|
19053
|
-
+ (showSearch ? `<div class="ws-head-actions"><input type="search" id="wf-landing-search" class="ws-landing-search" data-command-id="shell.workflows-landing-search" placeholder="${history ? 'Search runs' : pages ? 'Search pages' : 'Search workflows'}" aria-label="${history ? 'Search runs by workflow or project' : pages ? 'Search Pages by workflow, Page title or project' : 'Search workflows by name, project or tool'}" autocomplete="off" spellcheck="false" value="${esc(wfLandingQuery)}"
|
|
19136
|
+
+ (showSearch ? `<div class="ws-head-actions"><input type="search" id="wf-landing-search" class="ws-landing-search" data-command-id="shell.workflows-landing-search" placeholder="${history ? 'Search runs' : pages ? 'Search pages' : 'Search workflows'}" aria-label="${history ? 'Search runs by workflow or project' : pages ? 'Search Pages by workflow, Page title or project' : 'Search workflows by name, project or tool'}" autocomplete="off" spellcheck="false" value="${esc(wfLandingQuery)}">`
|
|
19137
|
+
// #2866: Sort by orders the workflow cards; Pages and History keep their own order, so it is absent there.
|
|
19138
|
+
+ (!pages && !history && globalThis.flolessLandingSort ? globalThis.flolessLandingSort.controlHtml('workflows') : '') + `</div>` : '')
|
|
19054
19139
|
+ `</div>`;
|
|
19055
19140
|
}
|
|
19056
19141
|
|
|
@@ -19139,7 +19224,23 @@
|
|
|
19139
19224
|
};
|
|
19140
19225
|
}
|
|
19141
19226
|
const focusedRestored = document.activeElement?.closest?.('[data-wf-restored]')?.dataset.wfRestored || null;
|
|
19227
|
+
// #2866: a background repaint (apps-changed, routines) must not drop a keyboard user off the Sort by controls.
|
|
19228
|
+
const focusedSort = document.activeElement?.closest?.('#wf-landing .ls-sort button')?.id || null;
|
|
19142
19229
|
const esc = (s) => String(s ?? '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
19230
|
+
// #2866: the page's Sort by choice orders the cards inside each section; the sections keep their order. Your own
|
|
19231
|
+
// workflows carry FloLess's record of when they were created and last changed (made, compiled, renamed, archived);
|
|
19232
|
+
// an installed workflow has only its install time, which is not when it was written, so it counts as undated.
|
|
19233
|
+
const sorter = globalThis.flolessLandingSort || null;
|
|
19234
|
+
const sortState = sorter ? sorter.get('workflows') : null;
|
|
19235
|
+
const ownedRecordOf = (row) => row.ownedWorkflow
|
|
19236
|
+
? { ...(wfOwned.find((item) => item.workflowId === row.ownedWorkflow.workflowId) || {}), ...row.ownedWorkflow } : null;
|
|
19237
|
+
const sortKeysOf = (row) => {
|
|
19238
|
+
const own = row.workflowId && !row.ownedWorkflow ? row : ownedRecordOf(row);
|
|
19239
|
+
return { name: own ? own.displayName : (row.displayName || row.name || row.id), id: row.id || row.workflowId,
|
|
19240
|
+
created: own ? own.createdAt : null, modified: own ? own.updatedAt : null };
|
|
19241
|
+
};
|
|
19242
|
+
const sortRows = (list) => (sorter ? sorter.sort(list, sortState, sortKeysOf) : list);
|
|
19243
|
+
const dateLine = (row) => { const k = sortKeysOf(row); return sorter ? sorter.cardDate(sortState, k.created, k.modified) : ''; };
|
|
19143
19244
|
const restoredRows = wfOwned.filter((row) => row.status !== 'archived' && row.restoreRefreshState);
|
|
19144
19245
|
const restoredIds = new Set(restoredRows.map((row) => row.workflowId));
|
|
19145
19246
|
const owned = wfLibrary.filter((row) => row.ownedWorkflow && !restoredIds.has(row.ownedWorkflow.workflowId));
|
|
@@ -19158,6 +19259,7 @@
|
|
|
19158
19259
|
return `<div class="ws-card wf-card wf-card-archived" data-wf-archived="${esc(row.workflowId)}">`
|
|
19159
19260
|
+ `<div class="ws-body"><div class="wf-card-text"><span class="ws-kind wf-kind is-draft">Archived</span>`
|
|
19160
19261
|
+ `<div class="ws-name">${esc(row.displayName)}</div><div class="ws-meta">${esc(row.ownerLabel || 'Standalone')}</div>`
|
|
19262
|
+
+ (dateLine(row) ? `<div class="ws-meta wf-card-nodes">${esc(dateLine(row))}</div>` : '')
|
|
19161
19263
|
+ `<div class="wf-draft-actions"><button type="button" data-wf-restore="${esc(row.workflowId)}" data-command-id="workflow.unarchive#${esc(row.workflowId)}" data-command-instance-label="${esc(row.displayName)}" data-tip="Restore this workflow to the Workflows page with its files, chat and history"${busy ? ' disabled aria-busy="true"' : ''}>${busy ? 'Restoring…' : 'Restore'}</button></div>`
|
|
19162
19264
|
+ `</div></div></div>`;
|
|
19163
19265
|
};
|
|
@@ -19171,7 +19273,8 @@
|
|
|
19171
19273
|
const meta = `${recompile ? (unreadableOwned.has(row.workflowId) ? 'Compiled copy unreadable' : 'Compiled copy missing') : 'Not compiled yet'} · ${row.ownerLabel || 'Standalone'}`;
|
|
19172
19274
|
return `<div class="ws-card wf-card wf-card-draft" role="button" tabindex="0" data-wf-draft="${esc(row.workflowId)}" data-command-id="shell.workflows-landing-open-draft#${esc(name)}" data-command-instance-label="${esc(name)}">`
|
|
19173
19275
|
+ `<div class="ws-body"><div class="wf-card-text"><span class="ws-kind wf-kind is-draft">${chip}</span>`
|
|
19174
|
-
+ `<div class="ws-name">${esc(name)}</div><div class="ws-meta">${esc(meta)}</div
|
|
19276
|
+
+ `<div class="ws-name">${esc(name)}</div><div class="ws-meta">${esc(meta)}</div>`
|
|
19277
|
+
+ (dateLine(row) ? `<div class="ws-meta wf-card-nodes">${esc(dateLine(row))}</div>` : '') + `</div></div></div>`;
|
|
19175
19278
|
};
|
|
19176
19279
|
const card = (row) => {
|
|
19177
19280
|
const ownedRow = row.ownedWorkflow;
|
|
@@ -19183,20 +19286,24 @@
|
|
|
19183
19286
|
+ `<div class="ws-body"><div class="wf-card-text"><span class="ws-kind wf-kind">${chip}</span>`
|
|
19184
19287
|
+ (scheduledTip ? `<span class="ws-kind wf-kind wf-scheduled" data-tip="${esc(scheduledTip)}">Scheduled</span>` : '')
|
|
19185
19288
|
+ `<div class="ws-name">${esc(name)}</div><div class="ws-meta">${esc(where)}</div>`
|
|
19186
|
-
+ `<div class="ws-meta wf-card-nodes">${esc(workflowCardMeta(row))}</div></div></div></div>`;
|
|
19289
|
+
+ `<div class="ws-meta wf-card-nodes">${esc(workflowCardMeta(row) + (dateLine(row) ? ` · ${dateLine(row)}` : ''))}</div></div></div></div>`;
|
|
19187
19290
|
};
|
|
19188
19291
|
// One section: a disclosure whose summary names it and counts its cards. Your workflows and Installed start open,
|
|
19189
19292
|
// Archived starts closed; a section the person opened or closed stays that way (keptSections). The summary's
|
|
19190
19293
|
// Instructor carrier is passed whole by each caller: a command id is never assembled from parts.
|
|
19191
|
-
const section = (key, carrier, title, count, cards, openByDefault) => {
|
|
19294
|
+
const section = (key, carrier, title, count, cards, openByDefault, rows = []) => {
|
|
19192
19295
|
if (!count) return '';
|
|
19193
19296
|
const open = keptSections[key] ? keptSections[key].open : openByDefault;
|
|
19297
|
+
const undated = sorter ? sorter.undatedNote(sorter.undatedCount(rows, sortState, sortKeysOf), rows.length, sortState) : '';
|
|
19194
19298
|
return `<details class="ws-archived wf-section wf-${key}" data-wf-section="${key}"${open ? ' open' : ''}>`
|
|
19195
|
-
+ `<summary class="ws-archived-summary" ${carrier}><span class="ws-archived-caret hd-caret" aria-hidden="true">▸</span>${title} <span class="ws-archived-count">${count}</span
|
|
19299
|
+
+ `<summary class="ws-archived-summary" ${carrier}><span class="ws-archived-caret hd-caret" aria-hidden="true">▸</span>${title} <span class="ws-archived-count">${count}</span>`
|
|
19300
|
+
+ (undated ? ` <span class="ls-undated">${esc(undated)}</span>` : '') + `</summary>`
|
|
19196
19301
|
+ `<div class="ws-grid">${cards}</div></details>`;
|
|
19197
19302
|
};
|
|
19303
|
+
// Drafts and compiled workflows of yours sort together; a just-restored card stays last until the list refreshes.
|
|
19304
|
+
const yours = sortRows([...unlisted, ...owned]);
|
|
19198
19305
|
const yoursSection = section('yours', 'data-command-id="shell.workflows-landing-yours"', 'Your workflows', unlisted.length + owned.length + restoredRows.length,
|
|
19199
|
-
`${
|
|
19306
|
+
`${yours.map((row) => (unlisted.includes(row) ? draftCard(row) : card(row))).join('')}${restoredRows.map(restoredCard).join('')}`, true, yours);
|
|
19200
19307
|
$wfLanding.innerHTML = workflowsLandingHeadHtml(esc, Boolean(wfLibrary.length || unlisted.length || archived.length || restoredRows.length))
|
|
19201
19308
|
+ `<div class="ws-create-grid"><div class="ws-card ws-create ws-card-create wf-create" role="button" tabindex="0" data-wf-new="1" data-command-id="shell.workflows-landing-new">`
|
|
19202
19309
|
+ `<div class="ws-thumb">+</div><div class="ws-body"><div><div class="ws-name">New workflow</div>`
|
|
@@ -19204,8 +19311,8 @@
|
|
|
19204
19311
|
+ unreadableNote
|
|
19205
19312
|
+ '<div class="wf-setapart-slot ws-workflows"></div>'
|
|
19206
19313
|
+ (wfLibrary.length || unlisted.length || archived.length || restoredRows.length
|
|
19207
|
-
? yoursSection + section('installed', 'data-command-id="shell.workflows-landing-installed"', 'Installed', installed.length, installed.map(card).join(''), true)
|
|
19208
|
-
+ section('archived', 'data-command-id="shell.workflows-landing-archived"', 'Archived', archived.length, archived.map(archivedCard).join(''), false)
|
|
19314
|
+
? yoursSection + section('installed', 'data-command-id="shell.workflows-landing-installed"', 'Installed', installed.length, sortRows(installed).map(card).join(''), true, installed)
|
|
19315
|
+
+ section('archived', 'data-command-id="shell.workflows-landing-archived"', 'Archived', archived.length, sortRows(archived).map(archivedCard).join(''), false, archived)
|
|
19209
19316
|
+ '<div class="ws-empty-note ws-search-empty" id="wf-search-empty" role="status" aria-live="polite"></div>'
|
|
19210
19317
|
: '<div class="ws-empty-note">No active workflows yet. Start with New workflow, or ask AI Chat on the left.</div>');
|
|
19211
19318
|
for (const box of $wfLanding.querySelectorAll('.wf-section')) {
|
|
@@ -19218,6 +19325,7 @@
|
|
|
19218
19325
|
if (focusedDraft) $wfLanding.querySelector(`[data-wf-draft="${CSS.escape(focusedDraft)}"]`)?.focus();
|
|
19219
19326
|
if (focusedRestore) $wfLanding.querySelector(`[data-wf-restore="${CSS.escape(focusedRestore)}"]:not(:disabled)`)?.focus();
|
|
19220
19327
|
if (focusedRestored) $wfLanding.querySelector(`[data-wf-restored="${CSS.escape(focusedRestored)}"]`)?.focus();
|
|
19328
|
+
if (focusedSort) $wfLanding.querySelector(`#${CSS.escape(focusedSort)}`)?.focus({ preventScroll: true });
|
|
19221
19329
|
// #2603: project-workflows.js paints the set-apart folders it owns the answers for (globalThis: harnesses lack it).
|
|
19222
19330
|
globalThis.flolessProjectWorkflows?.renderLandingSetApart?.($wfLanding.querySelector('.wf-setapart-slot'), wfSetApart, () => loadApps());
|
|
19223
19331
|
if (keepCaret) $wfLanding.querySelector('#wf-landing-search')?.focus();
|
|
@@ -19411,10 +19519,11 @@
|
|
|
19411
19519
|
? `<button type="button" class="primary" id="wf-draft-compile" data-command-id="shell.workflow-draft-compile-again"${busy}>${d.compiling ? 'Compiling…' : 'Compile again'}</button>`
|
|
19412
19520
|
: `<button type="button" class="primary" id="wf-draft-compile" data-command-id="shell.workflow-draft-compile"${busy}>${d.compiling ? 'Compiling…' : 'Compile'}</button>`;
|
|
19413
19521
|
}
|
|
19522
|
+
// #2764: when AWARE refused the workflow, the server's fixed sentence for that kind of refusal; never "try again".
|
|
19414
19523
|
const failure = d.failed
|
|
19415
|
-
? `<div class="wf-draft-failure" role="alert" tabindex="-1" id="wf-draft-failure"
|
|
19524
|
+
? `<div class="wf-draft-failure" role="alert" tabindex="-1" id="wf-draft-failure">${esc(d.refusal?.error || 'FloLess couldn’t compile this workflow, so it isn’t ready to run yet. Ask the AI in this chat to check the workflow file, then compile again.')}`
|
|
19416
19525
|
+ `<div class="wf-draft-actions"><button type="button" class="primary" id="wf-draft-ask" data-command-id="shell.workflow-draft-ask-ai">Ask AI to fix</button>`
|
|
19417
|
-
+ `<button type="button" id="wf-draft-retry" data-command-id="shell.workflow-draft-retry">
|
|
19526
|
+
+ `<button type="button" id="wf-draft-retry" data-command-id="shell.workflow-draft-retry">Compile again</button></div></div>`
|
|
19418
19527
|
: '';
|
|
19419
19528
|
$wfDraft.innerHTML = `<div class="wf-draft-panel">`
|
|
19420
19529
|
+ `<h2 class="wf-draft-title" id="wf-draft-title" tabindex="-1">${esc(d.displayName)}</h2>`
|
|
@@ -19468,6 +19577,7 @@
|
|
|
19468
19577
|
showToast(`${ask.sentence ? `${ask.sentence} ` : ''}Nothing was renamed.`, 'warn');
|
|
19469
19578
|
}
|
|
19470
19579
|
d.failed = true;
|
|
19580
|
+
d.refusal = error?.body?.code === 'workflow-compile-failed' && typeof error.body.error === 'string' ? error.body : null;
|
|
19471
19581
|
renderDraftView();
|
|
19472
19582
|
document.getElementById('wf-draft-failure')?.focus();
|
|
19473
19583
|
return;
|
|
@@ -19477,7 +19587,7 @@
|
|
|
19477
19587
|
try {
|
|
19478
19588
|
await loadApps();
|
|
19479
19589
|
} catch (error) {
|
|
19480
|
-
reportErr(error);
|
|
19590
|
+
reportErr(error, 'refresh the workflow list', { retrySafe: true });
|
|
19481
19591
|
} finally {
|
|
19482
19592
|
d.busy = false;
|
|
19483
19593
|
}
|
|
@@ -19519,8 +19629,12 @@
|
|
|
19519
19629
|
if (event.target.closest('#wf-draft-compile, #wf-draft-retry')) { void compileDraftWorkflow(); return; }
|
|
19520
19630
|
if (event.target.closest('#wf-draft-archive') && draftWorkflow) { void archiveOwnedWorkflow(draftWorkflow.workflowId, draftWorkflow.displayName); return; }
|
|
19521
19631
|
if (event.target.closest('#wf-draft-ask') && draftWorkflow) {
|
|
19522
|
-
|
|
19523
|
-
|
|
19632
|
+
// #2764: the refusal stays in view here; when AI Chat cannot take the request, say so until it is closed.
|
|
19633
|
+
const open = window.flolessChat?.openDraft;
|
|
19634
|
+
const notTaken = (why) => showToast(why, 'warn', { persistent: true });
|
|
19635
|
+
if (typeof open !== 'function') { notTaken('AI Chat is still starting. Ask it to fix the workflow in a moment.'); return; }
|
|
19636
|
+
Promise.resolve(open(compileRefusalDraft(draftWorkflow.displayName, draftWorkflow.refusal)))
|
|
19637
|
+
.catch(() => notTaken('AI Chat couldn’t open here. Open this workflow’s chat and ask it to fix the workflow.'));
|
|
19524
19638
|
}
|
|
19525
19639
|
});
|
|
19526
19640
|
}
|