@floless/app 0.149.1 → 0.150.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 +101814 -88311
- package/dist/schemas/drawing-check.profile.v1.schema.json +45 -2
- package/dist/schemas/steel.model.v2.schema.json +9 -0
- package/dist/skills/floless-app-approval/SKILL.md +79 -4
- package/dist/skills/floless-app-onboarding/SKILL.md +4 -4
- package/dist/skills/floless-app-onboarding/references/aware-runtime.md +1 -1
- package/dist/skills/floless-app-onboarding/references/floless-app-tour.md +15 -13
- package/dist/skills/floless-app-routines/SKILL.md +4 -1
- package/dist/skills/floless-app-routines/references/routines-api.md +14 -2
- package/dist/skills/floless-app-steel-model/SKILL.md +4 -2
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +14 -9
- package/dist/skills/floless-app-workflows/SKILL.md +2 -2
- package/dist/templates/tekla-parser.flo +13 -3
- package/dist/web/agents.js +887 -0
- package/dist/web/app.css +458 -23
- package/dist/web/app.js +20 -5
- package/dist/web/aware.js +1339 -134
- package/dist/web/chat.css +50 -1
- package/dist/web/chat.js +1582 -52
- package/dist/web/commands-drawing-check.js +15 -0
- package/dist/web/commands-revit.js +5 -0
- package/dist/web/commands-shell.js +761 -47
- package/dist/web/commands-tekla-parser.js +8 -1
- package/dist/web/connections.js +57 -14
- package/dist/web/drawing-check-editor.html +10 -2
- package/dist/web/drawing-check-editor.js +569 -40
- package/dist/web/drawing-check-overlay.js +45 -2
- package/dist/web/index.html +98 -27
- package/dist/web/instructor.js +85 -8
- package/dist/web/leave-guard.js +1 -0
- package/dist/web/left-pane.js +20 -1
- package/dist/web/local-discovery.js +12 -2
- package/dist/web/model-editor.css +32 -32
- package/dist/web/model-panel-bridge.js +11 -3
- package/dist/web/model-viewport-lighting.js +4 -2
- package/dist/web/model-viewport-revit-adapter.js +3 -0
- package/dist/web/model-viewport-toolbar.js +6 -3
- package/dist/web/model-viewport.js +11 -1
- package/dist/web/revit-editor.css +14 -14
- package/dist/web/revit-editor.js +64 -12
- package/dist/web/steel-3d-core.js +133 -0
- package/dist/web/steel-3d-view.js +10 -0
- package/dist/web/steel-editor.html +171 -39
- package/dist/web/steel-model-v2-client-validation.js +11 -0
- package/dist/web/steel-model-v2-commands.js +80 -5
- package/dist/web/tool-updates.js +367 -0
- package/dist/web/workspaces.js +679 -59
- package/package.json +1 -1
package/dist/web/aware.js
CHANGED
|
@@ -68,6 +68,8 @@
|
|
|
68
68
|
// so reading `apps.get(id).ownedWorkflow` found nothing and a workflow's AI Chat scope and Units never resolved.
|
|
69
69
|
const workflowOwners = new Map();
|
|
70
70
|
function ownedWorkflowOf(id) { return (id && workflowOwners.get(id)) || null; }
|
|
71
|
+
/** What a workflow is called on screen: an owned workflow's own name, never its runtime app id (#1890 PR 3b-0). */
|
|
72
|
+
function workflowLabelOf(id) { return ownedWorkflowOf(id)?.ownedWorkflow?.displayName || id; }
|
|
71
73
|
function rememberWorkflowOwners(list) {
|
|
72
74
|
workflowOwners.clear();
|
|
73
75
|
for (const row of list) {
|
|
@@ -143,7 +145,7 @@
|
|
|
143
145
|
// ever changes and the pattern misses, we just fall back to the raw note.
|
|
144
146
|
function humanizeNote(text) {
|
|
145
147
|
const missing = missingAgentId(text);
|
|
146
|
-
if (missing) return `${agentDisplayName(missing)} is not installed. Install this
|
|
148
|
+
if (missing) return `${agentDisplayName(missing)} is not installed. Install this tool to use this step.`;
|
|
147
149
|
const m = /command\s+(\S+)\s+(?:not found|is mode-overridable);\s*using author-declared mode:\s*(read|write)/i.exec(text);
|
|
148
150
|
if (m) {
|
|
149
151
|
const cmd = m[1];
|
|
@@ -166,6 +168,19 @@
|
|
|
166
168
|
if (/executable lock does not match the trusted compiled lock/i.test(message)) {
|
|
167
169
|
return 'FloLess stopped this run because the workflow no longer matches the version that was approved. Ask your AI assistant to restore and approve the workflow, then try again.';
|
|
168
170
|
}
|
|
171
|
+
// #1996: FloLess's own run admission for a published workflow whose installed files changed (for example an
|
|
172
|
+
// approval carried forward outside FloLess). The server's words are internal; say what happened and what to do.
|
|
173
|
+
if (/active workflow publication is missing or changed/i.test(message)) {
|
|
174
|
+
return 'This workflow no longer matches the version FloLess published, so it did not run. Ask AI Chat to publish it again, then run it.';
|
|
175
|
+
}
|
|
176
|
+
// #1912: the adapter's own words for a run AWARE ended without a reason FloLess recognises.
|
|
177
|
+
// Never show them bare — say what is known and how to get help.
|
|
178
|
+
if (/^AWARE workflow run (?:failed|did not finish)$/i.test(String(message).trim())) {
|
|
179
|
+
// Same sentence as the server's plainRunFailureMessage (run-refusal.ts) — this is the backstop
|
|
180
|
+
// for a server that still sends the adapter's words.
|
|
181
|
+
return 'The workflow stopped before it finished, and FloLess cannot explain the reason in plain words yet. '
|
|
182
|
+
+ 'Run it again, and if it stops again, report this problem so we can look into it.';
|
|
183
|
+
}
|
|
169
184
|
return message;
|
|
170
185
|
}
|
|
171
186
|
|
|
@@ -220,15 +235,15 @@
|
|
|
220
235
|
const busyLabel = installed.has(id) ? 'Checking' : 'Installing';
|
|
221
236
|
const busyDetail = installed.has(id) ? 'Checking the installed version. Please wait.' : 'Installation is in progress. Please wait.';
|
|
222
237
|
return `<li class="missing-agent-row"><div><strong>${escapeHtml(agentDisplayName(id))}</strong>` +
|
|
223
|
-
`<div class="missing-agent-detail">${busy ? busyDetail : failure ? 'Installation needs attention.' : done ? 'Installed. Compile the workflow to refresh its checks.' : check ? 'Installed on this computer. Check that its version matches this workflow.' : 'Install this
|
|
238
|
+
`<div class="missing-agent-detail">${busy ? busyDetail : failure ? 'Installation needs attention.' : done ? 'Installed. Compile the workflow to refresh its checks.' : check ? 'Installed on this computer. Check that its version matches this workflow.' : 'Install this tool to use these steps.'} Used by: ${escapeHtml([...nodes].join(', '))}.</div>` +
|
|
224
239
|
(failure ? `<div class="missing-agent-error" role="status">Could not install: ${escapeHtml(failure)}</div>` : '') +
|
|
225
|
-
`</div><button class="btn small" type="button" data-note-install="${escapeAttr(id)}" data-command-id="shell.workflow-agent-install#${escapeAttr(id)}" data-command-instance-label="${escapeAttr(agentDisplayName(id))}" aria-label="${check ? `Check ${escapeAttr(agentDisplayName(id))} installation` : `${busy ? busyLabel : done ? 'Installed' : failure ? 'Try installing again:' : 'Install'} ${escapeAttr(agentDisplayName(id))}`}" ${busy || done ? `disabled data-blocked-reason="${busy ? busyDetail : 'This
|
|
240
|
+
`</div><button class="btn small" type="button" data-note-install="${escapeAttr(id)}" data-command-id="shell.workflow-agent-install#${escapeAttr(id)}" data-command-instance-label="${escapeAttr(agentDisplayName(id))}" aria-label="${check ? `Check ${escapeAttr(agentDisplayName(id))} installation` : `${busy ? busyLabel : done ? 'Installed' : failure ? 'Try installing again:' : 'Install'} ${escapeAttr(agentDisplayName(id))}`}" ${busy || done ? `disabled data-blocked-reason="${busy ? busyDetail : 'This tool is installed. Compile the workflow to refresh its checks.'}"` : ''} aria-busy="${busy}">${busy ? `<span class="rtn-spinner"></span> ${busyLabel}…` : done ? 'Installed' : failure ? 'Try again' : check ? 'Check installation' : 'Install'}</button></li>`;
|
|
226
241
|
}).join('');
|
|
227
242
|
}
|
|
228
243
|
|
|
229
244
|
function missingAgentsBulkButton(pending, canInstall) {
|
|
230
245
|
if (pending.length <= 1) return '';
|
|
231
|
-
return `<button class="btn small" type="button" data-note-install-all data-command-id="shell.workflow-agents-install-all" aria-label="Install all missing
|
|
246
|
+
return `<button class="btn small" type="button" data-note-install-all data-command-id="shell.workflow-agents-install-all" aria-label="Install all missing tools" aria-busy="${!canInstall.length}" ${canInstall.length ? '' : 'disabled data-blocked-reason="Tool installations are in progress. Please wait."'}>${canInstall.length ? `Install all (${canInstall.length})` : 'Installing…'}</button>`;
|
|
232
247
|
}
|
|
233
248
|
|
|
234
249
|
const AGENT_ICONS = {
|
|
@@ -416,7 +431,7 @@
|
|
|
416
431
|
const capBadges = sk.capabilities.map((c) => `<span class="cap-badge">${escapeHtml(c)}</span>`).join(' ');
|
|
417
432
|
const inputsObj = Object.fromEntries(sk.inputs.map((i) => [i.name, inputSummary(i)]));
|
|
418
433
|
const docs = sk.homepage && /^https?:\/\//i.test(sk.homepage)
|
|
419
|
-
? `<p class="skill-docs-row"><a class="skill-docs" href="${escapeHtml(sk.homepage)}" target="_blank" rel="noopener">
|
|
434
|
+
? `<p class="skill-docs-row"><a class="skill-docs" href="${escapeHtml(sk.homepage)}" target="_blank" rel="noopener">Tool documentation ↗</a></p>`
|
|
420
435
|
: '';
|
|
421
436
|
const outputs = sk.outputs
|
|
422
437
|
? `<p><strong>Returns</strong> · ${escapeHtml(sk.outputs.type)}</p>${Object.keys(sk.outputs.schema).length ? kvTable(sk.outputs.schema) : ''}`
|
|
@@ -534,7 +549,7 @@
|
|
|
534
549
|
_frozen: !!n.frozen, // source node carries a `frozen:` block → card badge + Unfreeze menu
|
|
535
550
|
icon: iconFor(n.agent),
|
|
536
551
|
iconTip: iconTipFor(n.agent),
|
|
537
|
-
kind: n.kind === 'agent' && n.agent ? `${agentLabel}
|
|
552
|
+
kind: n.kind === 'agent' && n.agent ? `${agentLabel} tool` : escapeHtml(n.kind),
|
|
538
553
|
version: pin ? `v${escapeHtml(String(pin))}` : '—',
|
|
539
554
|
title: escapeHtml(n.id),
|
|
540
555
|
subtitle: `${agentLabel}${cmd ? '/' + cmd : ''} · ${mode}`,
|
|
@@ -591,7 +606,13 @@
|
|
|
591
606
|
];
|
|
592
607
|
if (app.notes.length) narration.push(`ℹ ${app.notes.length} workflow notice${app.notes.length === 1 ? '' : 's'} — review them above the canvas.`);
|
|
593
608
|
const maintainedDrift = app.publisher === 'floless' && !app.forked && app.runState === 'drift';
|
|
594
|
-
narration.push(app
|
|
609
|
+
narration.push(gateStateFor(app) === 'agent-changed'
|
|
610
|
+
? (app.approvalCheck && app.approvalCheck.remedy === 'needs-you'
|
|
611
|
+
? 'A tool version this workflow was approved with is not available. Choose in the notice above the canvas: reinstall that version, or **Compile** again.'
|
|
612
|
+
: Array.isArray(app.agentPinChanges) && app.agentPinChanges.length
|
|
613
|
+
? `A tool this workflow uses has changed since it was approved (${app.agentPinChanges.map((c) => escapeHtml(c.agentDisplayName)).join(', ')}). Click **Compile** before running it.`
|
|
614
|
+
: 'This workflow needs to be compiled again before it can run. Click **Compile**, then run it.')
|
|
615
|
+
: app.runnable
|
|
595
616
|
? 'The workflow matches its approved version. Review any notices before running.'
|
|
596
617
|
: maintainedDrift
|
|
597
618
|
? 'The workflow logic changed since it was last approved. **Restore** the official version, or **Customize** it to make it your own.'
|
|
@@ -615,6 +636,18 @@
|
|
|
615
636
|
function runStatePresentation(runState, activity = {}) {
|
|
616
637
|
const gate = {
|
|
617
638
|
ready: { label: 'Ready to run', className: 'ready' },
|
|
639
|
+
// #1912: the lock still matches the .flo, but it approved a different version of a tool than
|
|
640
|
+
// the one installed now — AWARE will refuse the run until it is compiled again.
|
|
641
|
+
'agent-changed': { label: 'Needs compile', className: 'drift' },
|
|
642
|
+
// #1996: ready, but part of the approval record is missing — it still runs; the attention colour
|
|
643
|
+
// asks the person to look. Presentation only: the gate itself (and the Instructor's runState) is 'ready'.
|
|
644
|
+
'ready-check-record': { label: 'Ready to run · check record', className: 'drift' },
|
|
645
|
+
// #1996: a published FloLess workflow whose approval changed outside FloLess. Compile is refused for a
|
|
646
|
+
// publication, so the pill names the step that works. Presentation only: the gate is 'agent-changed'.
|
|
647
|
+
'needs-publish': { label: 'Needs publishing', className: 'drift' },
|
|
648
|
+
// #1998: the exact tool version this workflow was approved with cannot run; the person chooses (reinstall
|
|
649
|
+
// it, or Compile again). Presentation only: the gate is 'agent-changed'.
|
|
650
|
+
'needs-you': { label: 'Needs you', className: 'drift' },
|
|
618
651
|
drift: { label: 'Needs refresh', className: 'drift' },
|
|
619
652
|
uncompiled: { label: 'Not set up', className: 'uncompiled' },
|
|
620
653
|
};
|
|
@@ -632,6 +665,414 @@
|
|
|
632
665
|
return gate[runState] || { label: '', className: '' };
|
|
633
666
|
}
|
|
634
667
|
|
|
668
|
+
// The gate the person sees. `runState` is the .flo↔.lock comparison and stays exactly that; a lock
|
|
669
|
+
// that still matches its source but pinned a tool version that is no longer installed (#1912) is
|
|
670
|
+
// shown as its own state, because AWARE will refuse that run until it is compiled again. Run stays
|
|
671
|
+
// enabled — AWARE's own gate refuses, and the failure card then says why.
|
|
672
|
+
//
|
|
673
|
+
// #1987: on AWARE >= 0.149 the server adds `approvalCheck` — AWARE's own answer to "would the run
|
|
674
|
+
// accept this approval?" (`aware app check`). It replaces the version comparison: an approved
|
|
675
|
+
// workflow keeps running on the tool files it was approved with after a tool update, so a newer
|
|
676
|
+
// installed version alone is no reason to compile. Without it (older AWARE, or the check could not
|
|
677
|
+
// answer), the version comparison stands.
|
|
678
|
+
function gateStateFor(app) {
|
|
679
|
+
const changed = app.approvalCheck
|
|
680
|
+
? app.approvalCheck.current === false
|
|
681
|
+
: Array.isArray(app.agentPinChanges) && app.agentPinChanges.length > 0;
|
|
682
|
+
return app.runState === 'ready' && changed ? 'agent-changed' : app.runState;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
function approvalCheckTip(check) {
|
|
686
|
+
const reasons = Array.isArray(check.reasons) && check.reasons.length
|
|
687
|
+
? check.reasons
|
|
688
|
+
: ['Something this workflow was approved with has changed.'];
|
|
689
|
+
// #1996: a missing part of the approval record is worth knowing even when it is not why the run waits.
|
|
690
|
+
const lines = [...reasons, ...(Array.isArray(check.recordWarnings) ? check.recordWarnings : [])].join('\n');
|
|
691
|
+
// #1996: the server names the remedy when it is not simply Compile; the words for it live here.
|
|
692
|
+
if (check.remedy === 'publish') {
|
|
693
|
+
// The server's reason already says FloLess will not run it as it is; no second line saying the same.
|
|
694
|
+
return `Needs publishing.\n${lines}\nAsk AI Chat to publish this workflow again, then Run workflow.`;
|
|
695
|
+
}
|
|
696
|
+
if (check.remedy === 'unconfirmed') {
|
|
697
|
+
return `Needs compile.\nFloLess could not confirm this workflow's approval just now.\n${lines}\nReopen the workflow to ask again, or press Compile to approve it again, then Run workflow.`;
|
|
698
|
+
}
|
|
699
|
+
if (check.remedy === 'needs-you') {
|
|
700
|
+
return `Needs you.\nA tool version this workflow was approved with is not available, and FloLess will not move the workflow to another version on its own.\n${lines}\nChoose in the notice above the canvas: reinstall that version, or Compile again.`;
|
|
701
|
+
}
|
|
702
|
+
if (check.remedy === 'update-aware') {
|
|
703
|
+
return `Needs compile.\nThis workflow will not run with the AWARE installed here.\n${lines}\nUpdate AWARE, or press Compile to approve the workflow again, then Run workflow.`;
|
|
704
|
+
}
|
|
705
|
+
return `Needs compile.\nThis workflow will not run yet, because something it was approved with has changed.\n${lines}\nPress Compile, then Run workflow.`;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// #1996: what the pill shows for a gate state. The gate itself (and the Instructor's runState) is unchanged;
|
|
709
|
+
// only the label can say more.
|
|
710
|
+
function presentedGateState(app, gateState) {
|
|
711
|
+
if (gateState === 'agent-changed' && app.approvalCheck && app.approvalCheck.remedy === 'publish') return 'needs-publish';
|
|
712
|
+
if (gateState === 'agent-changed' && app.approvalCheck && app.approvalCheck.remedy === 'needs-you') return 'needs-you';
|
|
713
|
+
return recordNeedsCheck(app, gateState) ? 'ready-check-record' : gateState;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
// #1996: the gate is ready, but part of an approval record (this workflow's, or one behind a tool) is
|
|
717
|
+
// missing. AWARE still runs it; the pill asks the person to look.
|
|
718
|
+
function recordNeedsCheck(app, gateState) {
|
|
719
|
+
return gateState === 'ready' && !!app.approvalCheck && app.approvalCheck.record === 'incomplete';
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
// #1996: the Ready tooltip for an approval AWARE moved to newer tool versions without a new Compile,
|
|
723
|
+
// and for any approval whose record is incomplete. AWARE's own label goes last, verbatim, so a long
|
|
724
|
+
// one never pushes the next step out of view. Returns null for a plain original approval.
|
|
725
|
+
function approvalRecordTip(check) {
|
|
726
|
+
if (!check) return null;
|
|
727
|
+
const carried = check.origin === 'successor';
|
|
728
|
+
const warnings = Array.isArray(check.recordWarnings) ? check.recordWarnings : [];
|
|
729
|
+
if (!carried && warnings.length === 0) return null;
|
|
730
|
+
const lines = ['Ready to run.'];
|
|
731
|
+
if (carried) lines.push('This workflow was approved with older tool versions. That approval has been moved to the versions it runs with now, so you do not need to compile again.');
|
|
732
|
+
lines.push(...warnings);
|
|
733
|
+
// Each warning already ends with its own next step (Compile this workflow, or the one behind a tool).
|
|
734
|
+
if (!warnings.length) lines.push('Optional: press Compile to approve it yourself.');
|
|
735
|
+
if (carried && check.label) lines.push(`Recorded by AWARE: ${check.label}`);
|
|
736
|
+
return lines.join('\n');
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
function agentPinChangeTip(changes) {
|
|
740
|
+
const lines = changes.map((c) => (c.approved
|
|
741
|
+
? `${c.agentDisplayName}: approved with version ${c.approved}, version ${c.installed} is installed now.`
|
|
742
|
+
: `${c.agentDisplayName}: version ${c.installed} is installed, but this workflow was approved without it.`));
|
|
743
|
+
return `Needs compile.\nA tool this workflow uses has changed since it was approved, so it will not run yet.\n${lines.join('\n')}\nPress Compile, then Run workflow.`;
|
|
744
|
+
}
|
|
745
|
+
// ── #1998: approval strip — "Needs you" choices, and where a carried-over approval came from ───────────
|
|
746
|
+
//
|
|
747
|
+
// Two states, one element above the canvas (beside the compiler notes):
|
|
748
|
+
// • needs-you (warn): the exact tool version this workflow was approved with cannot run. One row per
|
|
749
|
+
// tool, with the person's two choices — reinstall that version, or Compile again. FloLess never moves
|
|
750
|
+
// the workflow to another version on its own, and Run stays a choice (AWARE refuses and says why).
|
|
751
|
+
// • carried over (neutral provenance, like "Informed by"): AWARE moved the approval to a newer tool
|
|
752
|
+
// version without a new Compile. The summary is FloLess's plain words; AWARE's own record is shown
|
|
753
|
+
// verbatim in the details, because that record is the label — never "unchanged behaviour".
|
|
754
|
+
const $approvalStrip = document.getElementById('approval-strip');
|
|
755
|
+
let approvalStripReinstalling = null; // `${appId}\u0000${agent}` while a reinstall is in flight
|
|
756
|
+
|
|
757
|
+
function approvalStripState(app) {
|
|
758
|
+
const check = app && app.approvalCheck;
|
|
759
|
+
if (!check) return null;
|
|
760
|
+
if (presentedGateState(app, gateStateFor(app)) === 'needs-you') return 'needs-you';
|
|
761
|
+
if (check.current && check.origin === 'successor' && Array.isArray(check.successors) && check.successors.length) return 'carried';
|
|
762
|
+
return null;
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
/** "Verbot 1.0.0 → 1.0.1" for every tool this link moved. */
|
|
766
|
+
function carriedMoves(link) {
|
|
767
|
+
return (Array.isArray(link.moved) ? link.moved : [])
|
|
768
|
+
.map((m) => `${m.name || m.agent} ${m.from || '?'} → ${m.to || '?'}`).join(', ');
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/** Who allowed a link, in plain words. AWARE records this as a claim, so the details quote its record. */
|
|
772
|
+
function carriedBy(link) {
|
|
773
|
+
if (link.byKind === 'policy') return link.actor ? `carried over under a policy allowed by ${link.actor}` : 'carried over under a policy';
|
|
774
|
+
return link.actor ? `approved by ${link.actor}` : 'approved by a person';
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
function unavailableSentence(u) {
|
|
778
|
+
const tool = `${u.name} ${u.version || ''}`.trim();
|
|
779
|
+
if (u.removedBy === 'gc') return `${tool} was removed because no other workflow used it. This workflow was approved with that exact version.`;
|
|
780
|
+
if (u.resolution === 'digest-mismatch') return `${tool} was changed after this workflow was approved with it.`;
|
|
781
|
+
if (u.resolution === 'missing') return `${u.name} is not installed. This workflow was approved with version ${u.version}.`;
|
|
782
|
+
return `${tool} is not installed any more. This workflow was approved with that exact version.`;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
function paintApprovalStrip(app) {
|
|
786
|
+
if (!$approvalStrip) return;
|
|
787
|
+
const state = app && app.id === currentId ? approvalStripState(app) : null;
|
|
788
|
+
if (!state) {
|
|
789
|
+
$approvalStrip.hidden = true;
|
|
790
|
+
$approvalStrip.innerHTML = '';
|
|
791
|
+
delete $approvalStrip.dataset.state;
|
|
792
|
+
return;
|
|
793
|
+
}
|
|
794
|
+
const check = app.approvalCheck;
|
|
795
|
+
$approvalStrip.hidden = false;
|
|
796
|
+
$approvalStrip.dataset.state = state;
|
|
797
|
+
$approvalStrip.dataset.appId = app.id;
|
|
798
|
+
if (state === 'needs-you') {
|
|
799
|
+
const rows = (check.unavailable || []).filter((u) => u.reinstall);
|
|
800
|
+
$approvalStrip.className = 'approval-strip approval-needs-you';
|
|
801
|
+
$approvalStrip.setAttribute('role', 'group');
|
|
802
|
+
$approvalStrip.setAttribute('aria-label', 'A tool version needs your decision');
|
|
803
|
+
$approvalStrip.innerHTML = `<div class="approval-head">⚠ Needs you</div>`
|
|
804
|
+
+ `<ul class="approval-rows">${rows.map((u) => {
|
|
805
|
+
const busy = approvalStripReinstalling === `${app.id}\u0000${u.agent}`;
|
|
806
|
+
const installedNote = u.installed
|
|
807
|
+
? `Reinstalling makes ${escapeHtml(u.version)} the installed version again. Workflows approved with ${escapeHtml(u.installed)} keep running as they do now.`
|
|
808
|
+
: `Reinstalling installs ${escapeHtml(u.name)} ${escapeHtml(u.version)}.`;
|
|
809
|
+
return `<li class="approval-row" data-agent="${escapeAttr(u.agent)}">`
|
|
810
|
+
+ `<div class="approval-row-text"><div>${escapeHtml(unavailableSentence(u))} FloLess won’t switch it to another version for you.</div>`
|
|
811
|
+
+ `<div class="approval-row-note">${installedNote} Compiling again means you approve the workflow again, with the version installed at that moment.</div>`
|
|
812
|
+
+ `<div class="approval-row-error" role="status" aria-live="polite"></div></div>`
|
|
813
|
+
+ `<div class="approval-row-actions">`
|
|
814
|
+
+ `<button type="button" class="btn primary" data-approval-reinstall data-agent="${escapeAttr(u.agent)}" data-version="${escapeAttr(u.version)}"`
|
|
815
|
+
+ ` data-command-id="workflow.reinstall-approved-tool#${escapeAttr(u.agent)}" data-command-instance-label="${escapeAttr(`${u.name} ${u.version}`)}"`
|
|
816
|
+
+ ` data-tip="${escapeAttr(`Install ${u.name} ${u.version} again, so this workflow runs with the version it was approved with`)}"`
|
|
817
|
+
+ `${busy ? ' disabled aria-busy="true"' : ''}>${busy ? 'Reinstalling…' : escapeHtml(`Reinstall ${u.name} ${u.version}`)}</button>`
|
|
818
|
+
+ `<button type="button" class="btn" data-approval-compile data-command-id="workflow.approval-compile-again"`
|
|
819
|
+
+ ` data-tip="Approve this workflow again with the tool versions installed when it compiles"${approvalStripReinstalling ? ' disabled' : ''}>Compile again</button>`
|
|
820
|
+
+ `</div></li>`;
|
|
821
|
+
}).join('')}</ul>`;
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
// carried over: neutral, quiet; the details hold every link with AWARE's own words.
|
|
825
|
+
const links = check.successors;
|
|
826
|
+
const last = links[links.length - 1];
|
|
827
|
+
$approvalStrip.className = 'approval-strip approval-carried';
|
|
828
|
+
$approvalStrip.setAttribute('role', 'note');
|
|
829
|
+
$approvalStrip.setAttribute('aria-label', 'Where this workflow’s approval came from');
|
|
830
|
+
$approvalStrip.innerHTML = `<details class="approval-details">`
|
|
831
|
+
+ `<summary data-command-id="workflow.approval-carried-details" data-tip="Show where this approval came from">`
|
|
832
|
+
+ `<span class="approval-carried-label">Approval carried over</span>`
|
|
833
|
+
+ `<span class="approval-carried-sep">·</span><span>${escapeHtml(carriedMoves(last))}</span>`
|
|
834
|
+
+ `<span class="approval-carried-sep">·</span><span>${escapeHtml(carriedBy(last))}</span></summary>`
|
|
835
|
+
+ `<div class="approval-carried-body">`
|
|
836
|
+
+ `<p>This workflow’s approval was moved to the tool version it runs with now, without compiling again. Each step is listed below with AWARE’s own record of who allowed it and what was checked. Compile again at any time to approve it yourself.</p>`
|
|
837
|
+
+ links.map((link) => `<div class="approval-link"><div class="approval-link-head">${escapeHtml(carriedMoves(link))}`
|
|
838
|
+
+ `${link.promotedAt ? ` · ${escapeHtml(absTimeOf(link.promotedAt))}` : ''}`
|
|
839
|
+
+ `${link.kind === 'reverted' ? ' · moved back to an earlier approved version' : ''}</div>`
|
|
840
|
+
+ `<div class="approval-link-label-head">AWARE’s record (exact words)</div>`
|
|
841
|
+
+ `<blockquote class="approval-link-label">${escapeHtml(link.label || check.label || '')}</blockquote></div>`).join('')
|
|
842
|
+
+ `</div></details>`;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
function absTimeOf(iso) {
|
|
846
|
+
const d = new Date(iso);
|
|
847
|
+
return isNaN(d.getTime()) ? '' : d.toLocaleString();
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
/** The Execution log's run-start line: which approval the run ran under, when it was carried over. */
|
|
851
|
+
function runStartApprovalNote(ev) {
|
|
852
|
+
const cfg = (ev && (ev.config || ev.run_config)) || null;
|
|
853
|
+
const a = cfg && cfg.approval;
|
|
854
|
+
if (!a || a.origin === 'original') return '';
|
|
855
|
+
if (a.origin !== 'successor') return ` · an approval FloLess does not recognise — AWARE’s record: ${escapeHtml(a.label || 'none')}`;
|
|
856
|
+
return ` · approval carried over — AWARE’s record: ${escapeHtml(a.label || 'carried forward')}`;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
if ($approvalStrip) {
|
|
860
|
+
$approvalStrip.addEventListener('click', async (e) => {
|
|
861
|
+
const compile = e.target.closest && e.target.closest('[data-approval-compile]');
|
|
862
|
+
if (compile && !compile.disabled) { $compileBtn.click(); return; }
|
|
863
|
+
const btn = e.target.closest && e.target.closest('[data-approval-reinstall]');
|
|
864
|
+
if (!btn || btn.disabled || !currentId) return;
|
|
865
|
+
const id = currentId;
|
|
866
|
+
// The selection as it stands now: a workflow opened (or still loading) after this click must never be
|
|
867
|
+
// replaced by this one when the reinstall finishes.
|
|
868
|
+
const ticketAtClick = selectionTicket;
|
|
869
|
+
const stillHere = () => currentId === id && selectionTicket === ticketAtClick;
|
|
870
|
+
// Whatever is on screen when this finishes is repainted, so no strip is left showing "Reinstalling…"
|
|
871
|
+
// with its buttons disabled; only a RELOAD is held back for a workflow the person has left.
|
|
872
|
+
const repaintShown = () => { const shown = currentId && apps.get(currentId); if (shown) paintApprovalStrip(shown); };
|
|
873
|
+
const agent = btn.dataset.agent;
|
|
874
|
+
const version = btn.dataset.version;
|
|
875
|
+
approvalStripReinstalling = `${id}\u0000${agent}`;
|
|
876
|
+
const wasCompileDisabled = $compileBtn.disabled;
|
|
877
|
+
$compileBtn.disabled = true; // never approve whichever copy happens to be installed mid-swap
|
|
878
|
+
const app = apps.get(id);
|
|
879
|
+
if (app) paintApprovalStrip(app);
|
|
880
|
+
let res = null;
|
|
881
|
+
let error = null;
|
|
882
|
+
try {
|
|
883
|
+
res = await api(`/api/app/${encodeURIComponent(id)}/reinstall-approved-tool`, { method: 'POST', body: JSON.stringify({ agent, version }) });
|
|
884
|
+
} catch (err) {
|
|
885
|
+
error = err;
|
|
886
|
+
} finally {
|
|
887
|
+
approvalStripReinstalling = null;
|
|
888
|
+
$compileBtn.disabled = wasCompileDisabled;
|
|
889
|
+
}
|
|
890
|
+
if (error && error.body && error.body.app) {
|
|
891
|
+
// The state moved on; repaint from it (only if the person is still on this workflow).
|
|
892
|
+
if (stillHere()) await loadApp(id).catch(reportErr);
|
|
893
|
+
else repaintShown();
|
|
894
|
+
showToast(error.message, 'info');
|
|
895
|
+
return;
|
|
896
|
+
}
|
|
897
|
+
if (error) {
|
|
898
|
+
repaintShown();
|
|
899
|
+
const row = stillHere() && $approvalStrip.querySelector(`.approval-row[data-agent="${CSS.escape(agent)}"] .approval-row-error`);
|
|
900
|
+
if (row) row.textContent = `${error.message} You can try again, or Compile again.`;
|
|
901
|
+
else showToast(error.message, 'warn'); // the person moved on: the failure still reaches them
|
|
902
|
+
return;
|
|
903
|
+
}
|
|
904
|
+
if (stillHere()) await loadApp(id).catch(reportErr);
|
|
905
|
+
else repaintShown();
|
|
906
|
+
if (typeof loadAgentCatalog === 'function') {
|
|
907
|
+
loadAgentCatalog().catch((err) => console.warn('[floless] the Agents list could not be refreshed after a reinstall', err));
|
|
908
|
+
}
|
|
909
|
+
showToast(res.message, res.reinstalled === true ? 'ok' : 'warn');
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
// ── #1998: the one-time carry-forward policy (first approval, and ≡ → Automatic tool updates…) ──────────────────
|
|
914
|
+
//
|
|
915
|
+
// The words come from the server, which hashes them; Allow sends that hash back, so what is recorded is
|
|
916
|
+
// exactly what was read. It is recorded from a person's click here; the server refuses a request without
|
|
917
|
+
// the browser's same-origin headers, an accident guard against a stray terminal request, not proof of a
|
|
918
|
+
// click (owner decision 1, #1985). "Not now" is remembered so the question is asked once.
|
|
919
|
+
const $policyModal = document.getElementById('policy-modal');
|
|
920
|
+
let policyView = null;
|
|
921
|
+
let policyMode = 'settings';
|
|
922
|
+
let policyReturnFocus = null;
|
|
923
|
+
|
|
924
|
+
function renderPolicyModal() {
|
|
925
|
+
const v = policyView;
|
|
926
|
+
const $body = document.getElementById('policy-body');
|
|
927
|
+
const $actions = document.getElementById('policy-actions');
|
|
928
|
+
const $title = document.getElementById('policy-title');
|
|
929
|
+
$title.textContent = policyMode === 'first' ? 'Let FloLess keep approved workflows up to date?' : 'Automatic tool updates';
|
|
930
|
+
if (!v) { $body.innerHTML = '<p class="policy-dim">Loading…</p>'; $actions.innerHTML = ''; return; }
|
|
931
|
+
if (v.loadError) {
|
|
932
|
+
// Never "off": a policy may well be active while FloLess cannot read it.
|
|
933
|
+
$body.innerHTML = `<p>FloLess could not read this setting just now, so it cannot say whether it is on: ${escapeHtml(v.loadError)}</p>`
|
|
934
|
+
+ '<p class="policy-dim">Try again in a moment.</p>';
|
|
935
|
+
$actions.innerHTML = '<button type="button" class="btn" data-policy-close data-command-id="shell.dialog-cancel#Automatic tool updates">Close</button>'
|
|
936
|
+
+ '<button type="button" class="btn primary" data-policy-retry data-command-id="shell.policy-retry">Try again</button>';
|
|
937
|
+
return;
|
|
938
|
+
}
|
|
939
|
+
if (!v.supported) {
|
|
940
|
+
$body.innerHTML = `<p>${escapeHtml(v.message || 'This needs a newer AWARE.')}</p><p class="policy-dim">Until then, every tool update asks you first.</p>`;
|
|
941
|
+
$actions.innerHTML = '<button type="button" class="btn" data-policy-close data-command-id="shell.dialog-cancel#Automatic tool updates">Close</button>';
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
944
|
+
const lines = String(v.statement || '').split('\n');
|
|
945
|
+
const intro = lines.filter((l) => !l.startsWith('•'));
|
|
946
|
+
const bullets = lines.filter((l) => l.startsWith('•')).map((l) => l.replace(/^•\s*/, ''));
|
|
947
|
+
const statement = `<div class="policy-statement" id="policy-statement"><p>${escapeHtml(intro[0] || '')}</p>`
|
|
948
|
+
+ `<ul>${bullets.map((b) => `<li>${escapeHtml(b)}</li>`).join('')}</ul>`
|
|
949
|
+
+ `<p>${escapeHtml(intro.slice(1).join(' '))}</p></div>`;
|
|
950
|
+
const active = (v.policies || []).filter((p) => p.state === 'active');
|
|
951
|
+
let status = '';
|
|
952
|
+
if (policyMode === 'settings') {
|
|
953
|
+
const p = active[0];
|
|
954
|
+
status = `<div class="policy-status"><span class="policy-badge ${v.on ? 'on' : 'off'}">${v.on ? 'On' : 'Off'}</span>`
|
|
955
|
+
+ `<span>${v.on
|
|
956
|
+
? escapeHtml(`Allowed by ${p && p.approvedBy ? p.approvedBy : 'a person'}${p && p.approvedAt ? ` on ${absTimeOf(p.approvedAt)}` : ''}`)
|
|
957
|
+
: 'Every tool update asks you first.'}</span></div>`
|
|
958
|
+
+ (active.length ? `<details class="policy-record"><summary data-command-id="shell.policy-record">AWARE’s record (exact words)</summary>`
|
|
959
|
+
+ active.map((a) => `<blockquote class="approval-link-label">${escapeHtml(a.label || a.id)}</blockquote>`).join('') + '</details>' : '');
|
|
960
|
+
}
|
|
961
|
+
const advanced = policyMode === 'settings'
|
|
962
|
+
? '<details class="policy-advanced"><summary data-command-id="shell.policy-advanced">Advanced</summary>'
|
|
963
|
+
+ '<p>Bigger updates, and workflows that change your models, always ask you first. AWARE cannot carry those over on its own yet, so there is nothing to switch on here.</p></details>'
|
|
964
|
+
: '';
|
|
965
|
+
$body.innerHTML = status + statement + advanced + '<div class="policy-error" role="status" aria-live="polite"></div>';
|
|
966
|
+
if (policyMode === 'first') {
|
|
967
|
+
$actions.innerHTML = '<span class="policy-dim policy-later">You can decide later in ≡ → Automatic tool updates.</span>'
|
|
968
|
+
+ '<button type="button" class="btn" data-policy-notnow data-command-id="shell.policy-not-now">Not now</button>'
|
|
969
|
+
+ '<button type="button" class="btn primary" data-policy-allow data-command-id="shell.policy-allow">Allow</button>';
|
|
970
|
+
} else {
|
|
971
|
+
$actions.innerHTML = '<button type="button" class="btn" data-policy-close data-command-id="shell.dialog-cancel#Automatic tool updates">Close</button>'
|
|
972
|
+
+ (v.on
|
|
973
|
+
? '<button type="button" class="btn" data-policy-off data-command-id="shell.policy-turn-off">Turn off</button>'
|
|
974
|
+
: '<button type="button" class="btn primary" data-policy-allow data-command-id="shell.policy-allow">Turn on</button>');
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
async function openPolicyModal(mode) {
|
|
979
|
+
if (!$policyModal) return;
|
|
980
|
+
policyMode = mode;
|
|
981
|
+
policyReturnFocus = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
982
|
+
policyView = null;
|
|
983
|
+
renderPolicyModal();
|
|
984
|
+
showModal($policyModal);
|
|
985
|
+
try { policyView = await api('/api/migration-policy'); }
|
|
986
|
+
catch (err) {
|
|
987
|
+
policyView = { loadError: err.message };
|
|
988
|
+
}
|
|
989
|
+
renderPolicyModal();
|
|
990
|
+
const first = $policyModal.querySelector('.modal-title');
|
|
991
|
+
if (first) first.focus();
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
function closePolicyModal() {
|
|
995
|
+
if (!$policyModal || !$policyModal.classList.contains('show')) return;
|
|
996
|
+
hideModal($policyModal);
|
|
997
|
+
if (policyReturnFocus && document.contains(policyReturnFocus)) policyReturnFocus.focus();
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
async function answerPolicyNotNow() {
|
|
1001
|
+
try { await api('/api/migration-policy/prompt', { method: 'POST', body: JSON.stringify({ decision: 'not-now' }) }); }
|
|
1002
|
+
catch (err) { console.warn('[floless] "Not now" could not be saved; the question comes back at the next approval', err); }
|
|
1003
|
+
closePolicyModal();
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
/** After a person's approval (Compile, Approve): ask once, if AWARE can record the answer. */
|
|
1007
|
+
async function maybeAskPolicyAfterApproval() {
|
|
1008
|
+
if (!$policyModal || $policyModal.classList.contains('show')) return;
|
|
1009
|
+
let v;
|
|
1010
|
+
try { v = await api('/api/migration-policy'); }
|
|
1011
|
+
catch (err) { console.warn('[floless] could not read the carry-forward setting after an approval', err); return; }
|
|
1012
|
+
if (!v || !v.supported || v.on || (v.prompt && v.prompt.answered)) return;
|
|
1013
|
+
// Let the "compiled" message land first; the question never covers it.
|
|
1014
|
+
setTimeout(() => { if (!$policyModal.classList.contains('show')) openPolicyModal('first'); }, 900);
|
|
1015
|
+
}
|
|
1016
|
+
|
|
1017
|
+
if ($policyModal) {
|
|
1018
|
+
$policyModal.addEventListener('click', async (e) => {
|
|
1019
|
+
const t = e.target.closest ? e.target.closest('button') : null;
|
|
1020
|
+
if (!t || t.disabled) return;
|
|
1021
|
+
const $err = $policyModal.querySelector('.policy-error');
|
|
1022
|
+
if (t.hasAttribute('data-policy-close')) { closePolicyModal(); return; }
|
|
1023
|
+
if (t.hasAttribute('data-policy-retry')) { const mode = policyMode; closePolicyModal(); openPolicyModal(mode); return; }
|
|
1024
|
+
if (t.hasAttribute('data-policy-notnow')) { await answerPolicyNotNow(); return; }
|
|
1025
|
+
if (t.hasAttribute('data-policy-allow') || t.hasAttribute('data-policy-off')) {
|
|
1026
|
+
const off = t.hasAttribute('data-policy-off');
|
|
1027
|
+
const prev = t.textContent;
|
|
1028
|
+
t.disabled = true; t.setAttribute('aria-busy', 'true'); t.textContent = off ? 'Turning off…' : 'Saving…';
|
|
1029
|
+
try {
|
|
1030
|
+
policyView = off
|
|
1031
|
+
? await api('/api/migration-policy/revoke', { method: 'POST', body: '{}' })
|
|
1032
|
+
: await api('/api/migration-policy', { method: 'POST', body: JSON.stringify({ statementSha256: policyView && policyView.statementSha256 }) });
|
|
1033
|
+
if (off) showToast('Automatic tool updates are off. Every update asks you first.', 'ok');
|
|
1034
|
+
else if (policyView && policyView.on) showToast('Allowed. Small read-only tool fixes carry your approval over.', 'ok');
|
|
1035
|
+
else {
|
|
1036
|
+
// AWARE took the record but does not treat any policy as active (e.g. it reads it as invalid): say so.
|
|
1037
|
+
const problem = policyView && (policyView.policies || []).map((p) => p.problem).find(Boolean);
|
|
1038
|
+
showToast(`AWARE did not turn automatic tool updates on${problem ? `: ${problem}` : ''}. Every update still asks you first.`, 'warn');
|
|
1039
|
+
}
|
|
1040
|
+
if (policyMode === 'first') { closePolicyModal(); return; }
|
|
1041
|
+
renderPolicyModal();
|
|
1042
|
+
const title = $policyModal.querySelector('.modal-title');
|
|
1043
|
+
if (title) title.focus();
|
|
1044
|
+
} catch (err) {
|
|
1045
|
+
if (err.body && err.body.statement && policyView) { policyView.statement = err.body.statement; policyView.statementSha256 = err.body.statementSha256; renderPolicyModal(); }
|
|
1046
|
+
t.disabled = false; t.removeAttribute('aria-busy'); t.textContent = prev;
|
|
1047
|
+
const $e = $policyModal.querySelector('.policy-error') || $err;
|
|
1048
|
+
if ($e) $e.textContent = err.message;
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
});
|
|
1052
|
+
// On the document, not the dialog: a re-render (Turn off → Turn on) replaces the focused button, and focus
|
|
1053
|
+
// then sits on <body>, where a dialog-level listener would never hear Esc.
|
|
1054
|
+
document.addEventListener('keydown', (e) => {
|
|
1055
|
+
if (!$policyModal.classList.contains('show')) return;
|
|
1056
|
+
if (e.key === 'Escape') {
|
|
1057
|
+
e.preventDefault();
|
|
1058
|
+
e.stopPropagation();
|
|
1059
|
+
if (policyMode === 'first') answerPolicyNotNow(); else closePolicyModal();
|
|
1060
|
+
return;
|
|
1061
|
+
}
|
|
1062
|
+
if (e.key === 'Tab') {
|
|
1063
|
+
const items = [...$policyModal.querySelectorAll('button:not([disabled]), summary, [tabindex="-1"].modal-title')].filter((el) => el.offsetParent !== null);
|
|
1064
|
+
if (!items.length) return;
|
|
1065
|
+
const firstEl = items[0]; const lastEl = items[items.length - 1];
|
|
1066
|
+
if (e.shiftKey && document.activeElement === firstEl) { e.preventDefault(); lastEl.focus(); }
|
|
1067
|
+
else if (!e.shiftKey && document.activeElement === lastEl) { e.preventDefault(); firstEl.focus(); }
|
|
1068
|
+
else if (!$policyModal.contains(document.activeElement)) { e.preventDefault(); firstEl.focus(); }
|
|
1069
|
+
}
|
|
1070
|
+
}, true); // capture: the dialog owns Esc/Tab while it is open, ahead of the shell's own Esc handling
|
|
1071
|
+
onBackdropDismiss($policyModal, () => { if (policyMode === 'first') answerPolicyNotNow(); else closePolicyModal(); });
|
|
1072
|
+
}
|
|
1073
|
+
window.openToolUpdatePolicy = () => openPolicyModal('settings');
|
|
1074
|
+
|
|
1075
|
+
|
|
635
1076
|
let reportRunning = false;
|
|
636
1077
|
let cancelRequested = false;
|
|
637
1078
|
let runningSimulation = false;
|
|
@@ -640,7 +1081,8 @@
|
|
|
640
1081
|
let foregroundStopping = false;
|
|
641
1082
|
|
|
642
1083
|
function paintRunState(app) {
|
|
643
|
-
const
|
|
1084
|
+
const gateState = gateStateFor(app);
|
|
1085
|
+
const status = runStatePresentation(presentedGateState(app, gateState), {
|
|
644
1086
|
reportRunning,
|
|
645
1087
|
stateRunning: state.running,
|
|
646
1088
|
simulating: runningSimulation,
|
|
@@ -663,7 +1105,17 @@
|
|
|
663
1105
|
'Listening…': 'The live trigger session is listening for the next host event.',
|
|
664
1106
|
'Cancelling…': 'The current run is being cancelled.',
|
|
665
1107
|
};
|
|
666
|
-
|
|
1108
|
+
if (gateState === 'agent-changed') {
|
|
1109
|
+
gateTips['agent-changed'] = app.approvalCheck ? approvalCheckTip(app.approvalCheck) : agentPinChangeTip(app.agentPinChanges);
|
|
1110
|
+
}
|
|
1111
|
+
// A lock from an older AWARE approved tool VERSIONS, not exact files. It runs; say quietly how to
|
|
1112
|
+
// tighten it, without turning it into a state the person has to act on.
|
|
1113
|
+
if (gateState === 'ready' && app.approvalCheck && app.approvalCheck.kind === 'version-only') {
|
|
1114
|
+
gateTips.ready += '\nOptional: compile again so this workflow is tied to the exact tool files it runs with, not just their version numbers.';
|
|
1115
|
+
}
|
|
1116
|
+
const recordTip = gateState === 'ready' ? approvalRecordTip(app.approvalCheck) : null;
|
|
1117
|
+
if (recordTip) gateTips.ready = recordTip;
|
|
1118
|
+
$runState.dataset.tip = activeTips[status.label] || gateTips[gateState] || '';
|
|
667
1119
|
|
|
668
1120
|
// Push a snapshot to the Instructor band. One-way: the band renders what it
|
|
669
1121
|
// is handed and never reaches back into workflow state.
|
|
@@ -671,9 +1123,12 @@
|
|
|
671
1123
|
const inputs = Array.isArray(app.inputs) ? app.inputs : [];
|
|
672
1124
|
const values = typeof currentInputs === 'function' ? currentInputs() || {} : {};
|
|
673
1125
|
window.Instructor.setWorkflow({
|
|
674
|
-
name: app.name || app.id,
|
|
675
|
-
runState:
|
|
1126
|
+
name: workflowLabelOf(app.id) === app.id ? (app.name || app.id) : workflowLabelOf(app.id),
|
|
1127
|
+
runState: gateState,
|
|
676
1128
|
statusLabel: status.label,
|
|
1129
|
+
// #1996: what the Instructor says for a not-confirmed carried-forward approval or an incomplete record.
|
|
1130
|
+
remedy: (app.approvalCheck && app.approvalCheck.remedy) || null,
|
|
1131
|
+
recordIncomplete: recordNeedsCheck(app, gateState),
|
|
677
1132
|
totalInputs: inputs.length,
|
|
678
1133
|
inputsSet: inputs.filter((i) => {
|
|
679
1134
|
const v = values[i.name];
|
|
@@ -687,6 +1142,7 @@
|
|
|
687
1142
|
// Task-language label (AEC users don't know "lock"/"drift"); the tooltip carries
|
|
688
1143
|
// the why + the Compile step.
|
|
689
1144
|
paintRunState(app);
|
|
1145
|
+
paintApprovalStrip(app);
|
|
690
1146
|
|
|
691
1147
|
// Keep Run disabled (and the header Stop shown) if a gate re-paint lands mid-run (#39) —
|
|
692
1148
|
// never let a re-render re-arm Run while a run is still in flight.
|
|
@@ -697,13 +1153,26 @@
|
|
|
697
1153
|
$runBtn.disabled = !app.runnable || reportRunning || state.running || foregroundStarting || foregroundStopping || !!foregroundTrigger;
|
|
698
1154
|
if ($stopRunBtn) $stopRunBtn.hidden = !(reportRunning || state.running || foregroundStopping || foregroundTrigger);
|
|
699
1155
|
if ($reportStop) $reportStop.hidden = !foregroundTrigger;
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
?
|
|
704
|
-
|
|
1156
|
+
const agentChanged = gateStateFor(app) === 'agent-changed';
|
|
1157
|
+
$runBtn.dataset.tip = agentChanged
|
|
1158
|
+
? (app.approvalCheck
|
|
1159
|
+
? (app.approvalCheck.remedy === 'publish'
|
|
1160
|
+
? 'This workflow changed outside FloLess since it was published — ask AI Chat to publish it again first'
|
|
1161
|
+
: app.approvalCheck.remedy === 'needs-you'
|
|
1162
|
+
? 'A tool version this workflow was approved with is not available — choose in the notice above the canvas'
|
|
1163
|
+
: app.approvalCheck.remedy === 'update-aware'
|
|
1164
|
+
? 'This workflow needs a newer AWARE — update AWARE, or press Compile first'
|
|
1165
|
+
: app.approvalCheck.remedy === 'unconfirmed'
|
|
1166
|
+
? 'FloLess could not confirm this approval just now — reopen the workflow, or press Compile first'
|
|
1167
|
+
: 'Something this workflow was approved with has changed — press Compile first')
|
|
1168
|
+
: 'A tool this workflow uses has changed since it was approved — press Compile first')
|
|
1169
|
+
: app.runnable
|
|
1170
|
+
? 'Run the approved workflow'
|
|
1171
|
+
: app.runState === 'drift'
|
|
1172
|
+
? 'Blocked: the .flo changed since the last approve — Compile first'
|
|
1173
|
+
: 'Blocked: not compiled — Compile first';
|
|
705
1174
|
|
|
706
|
-
const needsCompile = app.runState !== 'ready';
|
|
1175
|
+
const needsCompile = app.runState !== 'ready' || agentChanged;
|
|
707
1176
|
$compileBtn.disabled = false;
|
|
708
1177
|
$compileBtn.textContent = needsCompile ? '⎙ Compile *' : '⎙ Compile';
|
|
709
1178
|
|
|
@@ -727,12 +1196,12 @@
|
|
|
727
1196
|
// what the server reads to mirror inputs). Disabled-with-tooltip (teach the
|
|
728
1197
|
// path), not hidden. Label flips to "Re-bake" when already exposed-as-agent.
|
|
729
1198
|
if ($menuBakeItem) {
|
|
730
|
-
$menuBakeLabel.textContent = app.baked ? 'Re-bake
|
|
1199
|
+
$menuBakeLabel.textContent = app.baked ? 'Re-bake tool' : 'Bake into tool';
|
|
731
1200
|
$menuBakeItem.disabled = !app.runnable;
|
|
732
1201
|
$menuBakeItem.dataset.tip = app.runnable
|
|
733
1202
|
? (app.baked
|
|
734
|
-
? 'Already a reusable
|
|
735
|
-
: 'Package this workflow as a reusable
|
|
1203
|
+
? 'Already a reusable tool. Re-bake to refresh its exposed interface after edits.'
|
|
1204
|
+
: 'Package this workflow as a reusable tool — drop it as a single node in any other workflow.')
|
|
736
1205
|
: app.runState === 'drift'
|
|
737
1206
|
? 'Compile first — the .flo changed since the last approve, so Bake is blocked.'
|
|
738
1207
|
: 'Compile first — there is no approved lock yet, so Bake is blocked.';
|
|
@@ -760,7 +1229,7 @@
|
|
|
760
1229
|
$notesStrip.classList.remove('sev-info', 'sev-warn', 'sev-error');
|
|
761
1230
|
$notesStrip.classList.add('sev-' + worst);
|
|
762
1231
|
$notesStrip.innerHTML =
|
|
763
|
-
`<div class="notes-head"><span class="notes-title">${icon} ${missing.size ? (pending.length ? `${pending.length}
|
|
1232
|
+
`<div class="notes-head"><span class="notes-title">${icon} ${missing.size ? (pending.length ? `${pending.length} tool${pending.length === 1 ? ' needs' : 's need'} ${nextAction}` : unchecked ? 'Check tool installations before compiling' : 'Tools installed — compile to refresh checks') : `${n} workflow notice${n === 1 ? '' : 's'}`}</span>` +
|
|
764
1233
|
missingAgentsBulkButton(pending, canInstall) +
|
|
765
1234
|
`<button class="notes-dismiss" type="button" aria-label="Collapse compiler notes" data-tip="Collapse">×</button></div>` +
|
|
766
1235
|
(missing.size ? `<ul class="missing-agent-list" aria-live="polite">${missingAgentRows(missing)}</ul>` : '') +
|
|
@@ -1033,7 +1502,7 @@
|
|
|
1033
1502
|
});
|
|
1034
1503
|
steps.push({ label: 'Set inputs', note: 'the values this workflow runs with', done: allSet });
|
|
1035
1504
|
}
|
|
1036
|
-
steps.push({ label: 'Compile', note: 'freeze the approved lock', done: app
|
|
1505
|
+
steps.push({ label: 'Compile', note: 'freeze the approved lock', done: gateStateFor(app) === 'ready' });
|
|
1037
1506
|
steps.push({ label: 'Run', note: 'against the live host — results render here', done: !!guideFor(app.id).firstRunDone });
|
|
1038
1507
|
return steps;
|
|
1039
1508
|
}
|
|
@@ -1361,6 +1830,9 @@
|
|
|
1361
1830
|
});
|
|
1362
1831
|
const copied = await copyToClipboard(markedInstruction(request));
|
|
1363
1832
|
showToast(copied ? `${name} is ready · prompt copied` : `${name} is ready to discuss`, 'ok');
|
|
1833
|
+
// #1890 PR 3b-0: the new draft opens, so it is somewhere to come back to — not only a toast.
|
|
1834
|
+
try { ({ workflows: wfOwned } = await api('/api/workflows/owned')); openDraftWorkflow(workflow.workflowId); }
|
|
1835
|
+
catch { /* the draft is still on the Workflows page after the next refresh */ }
|
|
1364
1836
|
appendNarration(`Created <strong>${escapeHtml(name)}</strong> in its chosen location and asked your terminal AI to start there — watch the glowing <strong>requests</strong> pill (bottom-right), or switch to your terminal.${copied ? ' The prompt is also on your clipboard.' : ''}`);
|
|
1365
1837
|
loadRequests();
|
|
1366
1838
|
} catch (e) { reportErr(e); }
|
|
@@ -1370,6 +1842,11 @@
|
|
|
1370
1842
|
// Dims the canvas, raises the beacon, and points a small caption at it; Esc /
|
|
1371
1843
|
// click-away / either button dismiss it for good. Slice 2 of the onboarding beacon.
|
|
1372
1844
|
let _spotlightKey = null;
|
|
1845
|
+
let _spotlightResize = null;
|
|
1846
|
+
// The spotlight points at the workflow canvas, so it lives only while that canvas is on screen (#2007): it is held
|
|
1847
|
+
// back (not used up) while Workspaces, Agents or the Workflows list covers it, and syncSpotlightToMode() follows
|
|
1848
|
+
// every tab switch and the list closing.
|
|
1849
|
+
const canvasHidden = () => document.body.classList.contains('mode-agents') || inWorkspacesMode() || wfLanding;
|
|
1373
1850
|
function maybeSpotlight(app) {
|
|
1374
1851
|
if (!app) return;
|
|
1375
1852
|
const g = guideFor(app.id);
|
|
@@ -1377,12 +1854,38 @@
|
|
|
1377
1854
|
if (document.querySelector('.modal-backdrop.show')) return; // don't pile on a dialog
|
|
1378
1855
|
if ($contractEditor && !$contractEditor.hidden) return;
|
|
1379
1856
|
setTimeout(() => {
|
|
1380
|
-
|
|
1857
|
+
// Checked when it would open, so a workflow loaded behind Workspaces or Agents keeps its spotlight for later.
|
|
1858
|
+
if (currentId !== app.id || canvasHidden()) return; // switched away during the delay
|
|
1381
1859
|
if (guideFor(app.id).spotlightShown) return;
|
|
1382
1860
|
if (document.querySelector('.modal-backdrop.show')) return;
|
|
1861
|
+
if ($contractEditor && !$contractEditor.hidden) return; // the editor opened during the delay
|
|
1383
1862
|
showSpotlight(app);
|
|
1384
1863
|
}, 700);
|
|
1385
1864
|
}
|
|
1865
|
+
// Where the first-open caption bubble sits: just under the anchor (right-aligned to it), clamped so the
|
|
1866
|
+
// whole bubble stays inside the viewport. A zero-sized / missing anchor (the beacon is not laid out on
|
|
1867
|
+
// the landing) falls back to the top-right corner instead of the window origin (#2020).
|
|
1868
|
+
function spotlightBubblePosition(anchor, vw, vh, bw, bh) {
|
|
1869
|
+
const M = 8;
|
|
1870
|
+
const clamp = (v, lo, hi) => Math.max(lo, Math.min(hi, v));
|
|
1871
|
+
const laidOut = !!anchor && Number.isFinite(anchor.right) && Number.isFinite(anchor.bottom)
|
|
1872
|
+
&& (anchor.width > 0 || anchor.height > 0);
|
|
1873
|
+
const left = laidOut ? anchor.right - bw : vw - bw - 16;
|
|
1874
|
+
const top = laidOut ? anchor.bottom + 10 : 64;
|
|
1875
|
+
return { left: clamp(left, M, Math.max(M, vw - bw - M)), top: clamp(top, M, Math.max(M, vh - bh - M)) };
|
|
1876
|
+
}
|
|
1877
|
+
// Anchor the caption bubble just under the beacon, right-aligned to it, and keep the whole bubble
|
|
1878
|
+
// (so its Got it / Show me buttons) inside the window even when the beacon is not laid out (#2020).
|
|
1879
|
+
function placeSpotlightBubble($sp, $b) {
|
|
1880
|
+
const bubble = $sp.querySelector('.guide-spotlight-bubble');
|
|
1881
|
+
if (!bubble) return;
|
|
1882
|
+
bubble.style.maxWidth = Math.max(0, Math.min(280, window.innerWidth - 16)) + 'px';
|
|
1883
|
+
bubble.style.left = '0px'; bubble.style.top = '0px'; bubble.style.right = 'auto';
|
|
1884
|
+
const pos = spotlightBubblePosition($b.getBoundingClientRect(), window.innerWidth, window.innerHeight,
|
|
1885
|
+
bubble.offsetWidth, bubble.offsetHeight);
|
|
1886
|
+
bubble.style.left = pos.left + 'px';
|
|
1887
|
+
bubble.style.top = pos.top + 'px';
|
|
1888
|
+
}
|
|
1386
1889
|
function showSpotlight(app) {
|
|
1387
1890
|
const $sp = document.getElementById('guide-spotlight');
|
|
1388
1891
|
const $b = document.getElementById('guide-beacon');
|
|
@@ -1390,23 +1893,32 @@
|
|
|
1390
1893
|
setGuide(app.id, { spotlightShown: true });
|
|
1391
1894
|
$b.classList.add('spotlit');
|
|
1392
1895
|
$sp.hidden = false;
|
|
1393
|
-
// Anchor the caption bubble just under the beacon, right-aligned to it.
|
|
1394
1896
|
const bubble = $sp.querySelector('.guide-spotlight-bubble');
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1897
|
+
placeSpotlightBubble($sp, $b);
|
|
1898
|
+
// The window can narrow while the tip is open: re-clamp so Got it / Show me never leave the screen (#2020).
|
|
1899
|
+
releaseSpotlightListeners(); // a repeated show (guide state could not be saved) must not stack listeners
|
|
1900
|
+
_spotlightResize = () => placeSpotlightBubble($sp, $b);
|
|
1901
|
+
window.addEventListener('resize', _spotlightResize);
|
|
1400
1902
|
_spotlightKey = (e) => { if (e.key === 'Escape') { e.preventDefault(); hideSpotlight(); } };
|
|
1401
1903
|
document.addEventListener('keydown', _spotlightKey);
|
|
1402
1904
|
if (bubble) { try { bubble.focus(); } catch { /* */ } }
|
|
1403
1905
|
}
|
|
1906
|
+
// Called by workspaces.js after every tab switch: leaving Workflows closes an open spotlight; coming back offers one
|
|
1907
|
+
// that was held back while the canvas was hidden. One already shown stays shown-once.
|
|
1908
|
+
function syncSpotlightToMode() {
|
|
1909
|
+
if (canvasHidden()) { hideSpotlight(); return; }
|
|
1910
|
+
maybeSpotlight(currentId && apps.get(currentId));
|
|
1911
|
+
}
|
|
1404
1912
|
function hideSpotlight() {
|
|
1405
1913
|
const $sp = document.getElementById('guide-spotlight');
|
|
1406
1914
|
const $b = document.getElementById('guide-beacon');
|
|
1407
1915
|
if ($sp) $sp.hidden = true;
|
|
1408
1916
|
if ($b) $b.classList.remove('spotlit');
|
|
1917
|
+
releaseSpotlightListeners();
|
|
1918
|
+
}
|
|
1919
|
+
function releaseSpotlightListeners() {
|
|
1409
1920
|
if (_spotlightKey) { document.removeEventListener('keydown', _spotlightKey); _spotlightKey = null; }
|
|
1921
|
+
if (_spotlightResize) { window.removeEventListener('resize', _spotlightResize); _spotlightResize = null; }
|
|
1410
1922
|
}
|
|
1411
1923
|
|
|
1412
1924
|
// ── load / select / compile / run ───────────────────────────────────────────
|
|
@@ -1444,9 +1956,12 @@
|
|
|
1444
1956
|
|
|
1445
1957
|
async function loadApp(id) {
|
|
1446
1958
|
hideSpotlight(); // a spotlight pointing at the previous app's beacon must clear on switch
|
|
1959
|
+
const ticket = ++selectionTicket;
|
|
1447
1960
|
const payload = api(`/api/app/${encodeURIComponent(id)}`);
|
|
1448
1961
|
const read = beginPublicationAvailabilityRead(id, payload);
|
|
1449
1962
|
const { app, contractState } = await payload;
|
|
1963
|
+
if (ticket !== selectionTicket) return; // something newer was opened while this one loaded
|
|
1964
|
+
closeDraftView();
|
|
1450
1965
|
apps.set(id, app);
|
|
1451
1966
|
// A PARALLEL map, never a key on `app`. The app object is AWARE's app spec — `transform()`,
|
|
1452
1967
|
// `seedAppInputs()` and `paintGate()` all take it — and FloLess's reading OF that app does not
|
|
@@ -1469,7 +1984,7 @@
|
|
|
1469
1984
|
state.selectedAgentId = null;
|
|
1470
1985
|
state.hasRun = false;
|
|
1471
1986
|
if ($promptSel.value !== id) $promptSel.value = id;
|
|
1472
|
-
setComboTriggerLabel(id);
|
|
1987
|
+
setComboTriggerLabel(workflowLabelOf(id));
|
|
1473
1988
|
setComboSelected(id);
|
|
1474
1989
|
renderChat();
|
|
1475
1990
|
renderTopology(); // selects first node + renderInspect
|
|
@@ -1543,13 +2058,26 @@
|
|
|
1543
2058
|
if ($wfTrigger) $wfTrigger.disabled = true;
|
|
1544
2059
|
renderCanvasPlaceholder('loading');
|
|
1545
2060
|
let list;
|
|
2061
|
+
// #1890 PR 3b-0: the owned workflow open now, read before the owner map is refreshed — if its installed copy is
|
|
2062
|
+
// gone after this refresh, it shows its own recovery view instead of falling back to another workflow.
|
|
2063
|
+
const openOwned = currentId ? ownedWorkflowOf(currentId)?.ownedWorkflow ?? null : null;
|
|
2064
|
+
const openId = currentId;
|
|
2065
|
+
const generation = ++appsLoadGeneration;
|
|
2066
|
+
let owned = null;
|
|
1546
2067
|
try {
|
|
1547
2068
|
({ apps: list } = await api('/api/workflows/library'));
|
|
2069
|
+
try { ({ workflows: owned } = await api('/api/workflows/owned')); }
|
|
2070
|
+
catch { /* the owned list is additive here: a failed read keeps the drafts last shown */ }
|
|
2071
|
+
// An older refresh that finishes after a newer one must not overwrite what the newer one showed.
|
|
2072
|
+
if (generation !== appsLoadGeneration) return;
|
|
2073
|
+
if (owned) wfOwned = owned;
|
|
1548
2074
|
list = list.filter((a) => a.execution !== 'internal');
|
|
1549
2075
|
rememberWorkflowOwners(list);
|
|
1550
2076
|
wfLibrary = list;
|
|
1551
2077
|
} catch (e) {
|
|
1552
|
-
|
|
2078
|
+
// Usable before THIS refresh, or built by an earlier one (an overlapping refresh disabled it first, and its
|
|
2079
|
+
// own success was then superseded): a failed refresh never strands a picker that has workflows in it.
|
|
2080
|
+
if ((wasUsable || $promptSel.options.length > 0) && $wfTrigger) $wfTrigger.disabled = false;
|
|
1553
2081
|
throw e;
|
|
1554
2082
|
}
|
|
1555
2083
|
$promptSel.innerHTML = '';
|
|
@@ -1562,6 +2090,7 @@
|
|
|
1562
2090
|
workflowSelectionGeneration += 1;
|
|
1563
2091
|
refreshKbInformed(null); // invalidate any in-flight app read and remove workflow-only provenance
|
|
1564
2092
|
void refreshWorkflowUnits(null);
|
|
2093
|
+
if (draftWorkflow) { resolveOpenDraft(); return; }
|
|
1565
2094
|
notifyChatScope(); // the last workflow went away (archive/delete): AI Chat must let go of it too
|
|
1566
2095
|
$runBtn.disabled = true;
|
|
1567
2096
|
$compileBtn.disabled = true;
|
|
@@ -1587,12 +2116,41 @@
|
|
|
1587
2116
|
buildWorkflowCombo(list); // searchable, provider-grouped picker over the hidden select
|
|
1588
2117
|
// Restore the last-opened app (remembered across refresh); fall back to the
|
|
1589
2118
|
// first app when there's no saved choice or it's no longer installed.
|
|
2119
|
+
// #1890 PR 3b-0: an open draft keeps its view and its chat through every refresh; only its own publication
|
|
2120
|
+
// or archive moves it on.
|
|
2121
|
+
if (draftWorkflow) {
|
|
2122
|
+
await resolveOpenDraft();
|
|
2123
|
+
if (wfLanding) renderWorkflowsLanding();
|
|
2124
|
+
return;
|
|
2125
|
+
}
|
|
2126
|
+
if (openOwned?.workflowId && openId && !list.some((a) => a.id === openId)) {
|
|
2127
|
+
const stillOwned = wfOwned.find((row) => row.workflowId === openOwned.workflowId && row.status !== 'archived');
|
|
2128
|
+
if (stillOwned?.activePublication) {
|
|
2129
|
+
openDraftWorkflow(stillOwned.workflowId);
|
|
2130
|
+
if (wfLanding) renderWorkflowsLanding();
|
|
2131
|
+
return;
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
1590
2134
|
let startId = list[0].id;
|
|
1591
2135
|
try {
|
|
1592
2136
|
const saved = localStorage.getItem(LS_LAST_APP);
|
|
1593
2137
|
if (saved && list.some((a) => a.id === saved)) startId = saved;
|
|
1594
2138
|
} catch { /* ignore */ }
|
|
1595
|
-
|
|
2139
|
+
const ticketBefore = selectionTicket;
|
|
2140
|
+
try {
|
|
2141
|
+
await loadApp(startId);
|
|
2142
|
+
} catch (error) {
|
|
2143
|
+
// #1890 PR 3b-0: an owned workflow being uninstalled outside FloLess can still be listed for a moment (its lock is
|
|
2144
|
+
// gone, its folder not yet), so loading it fails. Its installed copy is missing: show its recovery view now —
|
|
2145
|
+
// unless something newer was opened meanwhile, which wins.
|
|
2146
|
+
const owned = ownedWorkflowOf(startId)?.ownedWorkflow;
|
|
2147
|
+
if (error?.status === 404 && owned?.workflowId) {
|
|
2148
|
+
if (selectionTicket !== ticketBefore + 1 || generation !== appsLoadGeneration) return; // a newer open or refresh won
|
|
2149
|
+
const row = wfOwned.find((item) => item.workflowId === owned.workflowId && item.status !== 'archived');
|
|
2150
|
+
if (row) { openDraftWorkflow(row.workflowId); return; }
|
|
2151
|
+
}
|
|
2152
|
+
throw error;
|
|
2153
|
+
}
|
|
1596
2154
|
// #1890: the Workflows tab starts on its landing (owner: people start there and tell AI Chat what they want); a
|
|
1597
2155
|
// later refresh (rename, delete, apps-changed) keeps whatever is showing.
|
|
1598
2156
|
if (!wfLandingBooted) { wfLandingBooted = true; showWorkflowsLanding(true); }
|
|
@@ -1642,6 +2200,16 @@
|
|
|
1642
2200
|
let wfLanding = false;
|
|
1643
2201
|
let wfLandingBooted = false;
|
|
1644
2202
|
let wfLibrary = [];
|
|
2203
|
+
// #1890 PR 3b-0: every owned workflow, drafts included (/api/workflows/owned), and the draft open in the canvas
|
|
2204
|
+
// area, if any. A draft has no runtime app, so it is never `currentId` and never goes to loadApp.
|
|
2205
|
+
let wfOwned = [];
|
|
2206
|
+
let draftWorkflow = null;
|
|
2207
|
+
// Opening anything (a workflow or a draft) takes a new ticket; a workflow load that finishes after a newer open
|
|
2208
|
+
// is dropped, so a slow load can never land on top of a draft opened meanwhile (#1890 PR 3b-0 review).
|
|
2209
|
+
let selectionTicket = 0;
|
|
2210
|
+
// Each loadApps() takes a number; only the newest may change the lists or what is open.
|
|
2211
|
+
let appsLoadGeneration = 0;
|
|
2212
|
+
let wsTitleKind = null; // #2007: 'agents' while the Agents tab is on screen (it reuses this title/Instructor seam)
|
|
1645
2213
|
let wsTitleName = null; // open Workspaces project name, or 'Workspaces' on its landing; null = Workflows mode
|
|
1646
2214
|
let wsTitleLanding = false; // explicit because a project may itself be named "Workspaces"
|
|
1647
2215
|
let wsTitleProjectId = null; // identity: two projects may legitimately share a display name
|
|
@@ -1803,7 +2371,7 @@
|
|
|
1803
2371
|
// #1890: the workflow under the landing is already loaded; picking it only leaves the landing.
|
|
1804
2372
|
showWorkflowsLanding(false);
|
|
1805
2373
|
}
|
|
1806
|
-
setComboTriggerLabel(id);
|
|
2374
|
+
setComboTriggerLabel(workflowLabelOf(id));
|
|
1807
2375
|
}
|
|
1808
2376
|
|
|
1809
2377
|
if ($wfTrigger) {
|
|
@@ -1939,7 +2507,7 @@
|
|
|
1939
2507
|
closeCombo(false);
|
|
1940
2508
|
const res = await formModal({
|
|
1941
2509
|
title: 'Archive workflow?',
|
|
1942
|
-
sub: `Hide “${name}” from Workflows and block new runs. Its source, chat, history and publications stay on this computer
|
|
2510
|
+
sub: `Hide “${name}” from Workflows and block new runs. Its source, chat, history and publications stay on this computer.`,
|
|
1943
2511
|
fields: [], okLabel: 'Archive', safeDefault: true,
|
|
1944
2512
|
});
|
|
1945
2513
|
if (!res) return;
|
|
@@ -1947,8 +2515,10 @@
|
|
|
1947
2515
|
await api(`/api/workflows/owned/${encodeURIComponent(workflowId)}/archive`, {
|
|
1948
2516
|
method: 'POST', body: JSON.stringify({ archived: true }),
|
|
1949
2517
|
});
|
|
2518
|
+
const wasOpenDraft = draftWorkflow?.workflowId === workflowId;
|
|
1950
2519
|
await loadApps();
|
|
1951
|
-
|
|
2520
|
+
// An open draft already said so when the refresh closed it (resolveOpenDraft) — one message, not two.
|
|
2521
|
+
if (!(wasOpenDraft && !draftWorkflow)) showToast(`Archived “${name}”`, 'ok');
|
|
1952
2522
|
} catch (e) { reportErr(e); }
|
|
1953
2523
|
}
|
|
1954
2524
|
|
|
@@ -1978,7 +2548,7 @@
|
|
|
1978
2548
|
// Warn (informed consent) — not a blocker; the user may be renaming an unreferenced
|
|
1979
2549
|
// one (#226 UX review).
|
|
1980
2550
|
const sub = 'This is the name you pick here, and what .flo files and your terminal AI use to refer to it.'
|
|
1981
|
-
+ (baked ? ' Renaming a baked workflow also renames its synthesized
|
|
2551
|
+
+ (baked ? ' Renaming a baked workflow also renames its synthesized tool — other workflows that use it as a node will need updating.' : '');
|
|
1982
2552
|
const res = await formModal({
|
|
1983
2553
|
title: 'Rename workflow',
|
|
1984
2554
|
sub,
|
|
@@ -2992,6 +3562,19 @@
|
|
|
2992
3562
|
// endpoint owns approval/account filtering and a signed, revision-bound cursor. A single retry
|
|
2993
3563
|
// state survives every full-list restart, so alternating session loss and picker changes cannot
|
|
2994
3564
|
// reset each other's bounds and mix more than one replacement snapshot into the result.
|
|
3565
|
+
// #1840: an approved Tekla version that accepted open import findings says so wherever it is picked
|
|
3566
|
+
// (Run inputs, routine inputs, scheduled runs). Empty for every other version.
|
|
3567
|
+
function acceptedFindingsMeta(version) {
|
|
3568
|
+
const open = Number(version && version.acceptedImportFindings && version.acceptedImportFindings.open);
|
|
3569
|
+
return Number.isSafeInteger(open) && open > 0 ? `${open.toLocaleString('en-US')} ${open === 1 ? 'finding' : 'findings'} accepted` : '';
|
|
3570
|
+
}
|
|
3571
|
+
/** The "Latest approved" choice resolves to the newest version, so it carries that version's label. */
|
|
3572
|
+
function latestAcceptedFindingsMeta(versions) {
|
|
3573
|
+
const newest = (versions || []).slice().sort((a, b) => Number(b.approvalVersion) - Number(a.approvalVersion))[0];
|
|
3574
|
+
const meta = acceptedFindingsMeta(newest);
|
|
3575
|
+
return meta ? `v${newest.approvalVersion} has ${meta}` : '';
|
|
3576
|
+
}
|
|
3577
|
+
|
|
2995
3578
|
async function fetchApprovedModelRevisions(module = 'revit', retries = Object.freeze({ auth: 0, changed: 0 })) {
|
|
2996
3579
|
try {
|
|
2997
3580
|
const projects = new Map();
|
|
@@ -3140,19 +3723,21 @@
|
|
|
3140
3723
|
const exact = project.versions.slice().sort((a, b) => Number(b.approvalVersion) - Number(a.approvalVersion)).map((version) => {
|
|
3141
3724
|
const date = version.approvedAt ? new Date(version.approvedAt).toLocaleDateString(undefined, { day: 'numeric', month: 'short', year: 'numeric' }) : 'Date unavailable';
|
|
3142
3725
|
const short = String(version.approvedRevisionId).slice(0, 10);
|
|
3726
|
+
const accepted = acceptedFindingsMeta(version);
|
|
3143
3727
|
return {
|
|
3144
3728
|
value: selection({ approvedRevisionId: version.approvedRevisionId, approvalVersion: version.approvalVersion }),
|
|
3145
3729
|
group: project.name, groupMeta: `${selectedModelName} model`, label: `Approved v${version.approvalVersion}`,
|
|
3146
|
-
triggerLabel: `${project.name} · approved v${version.approvalVersion} · ${short}`,
|
|
3147
|
-
meta: `${date} · ${short}`,
|
|
3148
|
-
ariaLabel: `${project.name}, ${selectedModelName} model, approved version ${version.approvalVersion}, ${date}, revision ${version.approvedRevisionId}`,
|
|
3730
|
+
triggerLabel: `${project.name} · approved v${version.approvalVersion} · ${short}${accepted ? ` · ${accepted}` : ''}`,
|
|
3731
|
+
meta: `${date} · ${short}${accepted ? ` · ${accepted}` : ''}`,
|
|
3732
|
+
ariaLabel: `${project.name}, ${selectedModelName} model, approved version ${version.approvalVersion}, ${date}, revision ${version.approvedRevisionId}${accepted ? `, approved with ${accepted.replace(/ accepted$/, '')} accepted as stated assumptions` : ''}`,
|
|
3149
3733
|
search: `${project.name} ${selectedModelName} approved version ${version.approvalVersion} ${date} ${version.approvedRevisionId}`,
|
|
3150
3734
|
};
|
|
3151
3735
|
});
|
|
3736
|
+
const latestAccepted = latestAcceptedFindingsMeta(project.versions);
|
|
3152
3737
|
return [...exact, {
|
|
3153
3738
|
value: selection({ latestApproved: true }), group: project.name, groupMeta: `${selectedModelName} model`, volatile: true,
|
|
3154
|
-
label: 'Latest approved', triggerLabel: `${project.name} · latest approved (volatile)`,
|
|
3155
|
-
meta:
|
|
3739
|
+
label: 'Latest approved', triggerLabel: `${project.name} · latest approved (volatile)${latestAccepted ? ` · ${latestAccepted}` : ''}`,
|
|
3740
|
+
meta: `changes when approvals change${latestAccepted ? ` · ${latestAccepted}` : ''}`,
|
|
3156
3741
|
ariaLabel: `${project.name}, ${selectedModelName} model, latest approved, changes when approvals change`,
|
|
3157
3742
|
search: `${project.name} ${selectedModelName} latest approved changes approvals volatile`,
|
|
3158
3743
|
}];
|
|
@@ -3391,8 +3976,18 @@
|
|
|
3391
3976
|
$reportShare.hidden = true;
|
|
3392
3977
|
showSavedPathActions('');
|
|
3393
3978
|
$reportOverlay.hidden = true; $reportOverlay.replaceChildren();
|
|
3979
|
+
// #1840: the caption says when the report's approved version accepted open import findings (the
|
|
3980
|
+
// server's sentence). The report body comes from AWARE's report protocol, which appears to have no
|
|
3981
|
+
// field for it (inferred from its parser's messages, not reproduced). When the server could not
|
|
3982
|
+
// read that approval's record, the caption says so instead of reading as a plain approval.
|
|
3394
3983
|
$reportSub.textContent = report.scheduledCaption
|
|
3395
3984
|
|| `Complete read-only report · ${count} objects · ${properties} properties · approved revision ${String(index.revisionId).slice(0, 12)} · source unchanged.`;
|
|
3985
|
+
if (typeof index.acceptedImportFindingsNote === 'string') $reportSub.textContent += ` ${index.acceptedImportFindingsNote}`;
|
|
3986
|
+
else if (index.approvalDetailsUnavailable === true) $reportSub.textContent += ' Approval details unavailable.';
|
|
3987
|
+
// What the report rests on comes first (a scheduled "Latest approved" run that read an older
|
|
3988
|
+
// approved version says which), never after the counts where it would read as a footnote.
|
|
3989
|
+
const warnings = Array.isArray(index.warnings) ? index.warnings.filter((warning) => typeof warning === 'string' && warning) : [];
|
|
3990
|
+
if (warnings.length) $reportSub.textContent = `${warnings.join(' ')} ${$reportSub.textContent}`;
|
|
3396
3991
|
} catch (error) {
|
|
3397
3992
|
if (request !== reportSectionRequest) return;
|
|
3398
3993
|
clearCompleteReportView();
|
|
@@ -4148,6 +4743,7 @@
|
|
|
4148
4743
|
}
|
|
4149
4744
|
await api(`/api/contract/${encodeURIComponent(appId)}/approve`, { method: 'POST' });
|
|
4150
4745
|
showToast('Approved — lock baked. Run is armed.', 'ok');
|
|
4746
|
+
maybeAskPolicyAfterApproval();
|
|
4151
4747
|
} catch (e) {
|
|
4152
4748
|
showToast('We couldn’t approve this workflow because FloLess could not save the approval. Try again.', 'warn');
|
|
4153
4749
|
} finally {
|
|
@@ -4241,9 +4837,7 @@
|
|
|
4241
4837
|
// Other recoverable failures (host not attached, stale lock, …): show it
|
|
4242
4838
|
// in the viewer overlay + a toast. No console.error — the server returns the
|
|
4243
4839
|
// failure in-band, so a failed run isn't a console-worthy fault.
|
|
4244
|
-
|
|
4245
|
-
$reportSub.textContent = 'The report could not be created.';
|
|
4246
|
-
showToast(runFailureMessage(msg), 'warn');
|
|
4840
|
+
showRunFailure(e.body || {}, runFailureMessage(msg), app);
|
|
4247
4841
|
}
|
|
4248
4842
|
}
|
|
4249
4843
|
} finally {
|
|
@@ -4268,6 +4862,54 @@
|
|
|
4268
4862
|
return n;
|
|
4269
4863
|
}
|
|
4270
4864
|
|
|
4865
|
+
// A run that failed for any reason other than Stop or an expired sign-in (#1912, #1851): the
|
|
4866
|
+
// plain sentence the server or runFailureMessage produced, the fix when there is one (Compile, for
|
|
4867
|
+
// an approval AWARE refused), and Report this problem every time. Reuses the reconnect card's
|
|
4868
|
+
// amber-topped layout; built with textContent only, so nothing the server says becomes markup.
|
|
4869
|
+
function showRunFailure(body, message, app) {
|
|
4870
|
+
const code = body && typeof body.code === 'string' ? body.code : '';
|
|
4871
|
+
const compileFix = (code === 'agent-version-changed' || code === 'needs-compile') && !$compileBtn.hidden;
|
|
4872
|
+
const reinstall = code === 'agent-files-changed';
|
|
4873
|
+
clearReportFrames();
|
|
4874
|
+
$reportShare.hidden = true;
|
|
4875
|
+
$reportOverlay.hidden = false;
|
|
4876
|
+
$reportOverlay.replaceChildren();
|
|
4877
|
+
$reportSub.textContent = 'The report could not be created.';
|
|
4878
|
+
|
|
4879
|
+
const card = mkEl('div', 'cred-fail-card run-fail-card');
|
|
4880
|
+
card.setAttribute('role', 'status');
|
|
4881
|
+
const status = mkEl('div', 'cred-fail-status');
|
|
4882
|
+
const icon = mkEl('span', 'cred-fail-icon', '⚠');
|
|
4883
|
+
icon.setAttribute('aria-hidden', 'true');
|
|
4884
|
+
status.append(icon, document.createTextNode(compileFix ? 'Needs compiling' : reinstall ? 'Tool changed' : 'Run stopped'));
|
|
4885
|
+
const headline = mkEl('div', 'cred-fail-headline', compileFix
|
|
4886
|
+
? 'This workflow needs compiling again'
|
|
4887
|
+
: reinstall ? 'A tool needs reinstalling' : 'The workflow stopped before it finished');
|
|
4888
|
+
const text = mkEl('div', 'cred-fail-body', message);
|
|
4889
|
+
const actions = mkEl('div', 'cred-fail-actions');
|
|
4890
|
+
if (compileFix) {
|
|
4891
|
+
const compile = mkEl('button', 'primary cred-reconnect run-fail-compile', 'Compile now');
|
|
4892
|
+
compile.type = 'button';
|
|
4893
|
+
compile.dataset.commandId = 'shell.run-failure-compile';
|
|
4894
|
+
compile.onclick = () => { hideModal($reportModal); $compileBtn.click(); };
|
|
4895
|
+
actions.append(compile);
|
|
4896
|
+
}
|
|
4897
|
+
const report = mkEl('button', 'cred-open-integrations run-fail-report', 'Report this problem');
|
|
4898
|
+
report.type = 'button';
|
|
4899
|
+
report.dataset.commandId = 'shell.run-failure-report';
|
|
4900
|
+
report.onclick = () => window.dispatchEvent(new CustomEvent('floless:report-run-issue', {
|
|
4901
|
+
// AWARE's own words (`reason`) go only into the report the person reviews before sending —
|
|
4902
|
+
// never onto the card, which must stay plain.
|
|
4903
|
+
detail: { workflow: (app && app.displayName) || currentId || '', message,
|
|
4904
|
+
reason: body && typeof body.reason === 'string' ? body.reason : '', returnFocus: report },
|
|
4905
|
+
}));
|
|
4906
|
+
actions.append(report);
|
|
4907
|
+
card.append(status, headline, text, actions);
|
|
4908
|
+
$reportOverlay.append(card);
|
|
4909
|
+
showToast(message, 'warn');
|
|
4910
|
+
(actions.querySelector('button') || report).focus();
|
|
4911
|
+
}
|
|
4912
|
+
|
|
4271
4913
|
const CRED_BODY_IDLE = 'Sign in again and then run the workflow — it takes about 30 seconds.';
|
|
4272
4914
|
|
|
4273
4915
|
function showCredentialReconnect(cred) {
|
|
@@ -5117,7 +5759,7 @@
|
|
|
5117
5759
|
|| $body.querySelector('.fm-files .fm-drop, .fm-file .fm-drop, .fm-images .fm-drop')
|
|
5118
5760
|
|| $body.querySelector('[data-fm-empty-action]:not([disabled])');
|
|
5119
5761
|
if (first) { first.focus(); if (first.select) first.select(); }
|
|
5120
|
-
else if ((danger || $ok.disabled) && !hideCancel) $cancel.focus();
|
|
5762
|
+
else if ((danger || safeDefault || $ok.disabled) && !hideCancel) $cancel.focus();
|
|
5121
5763
|
else $ok.focus();
|
|
5122
5764
|
const collect = () => {
|
|
5123
5765
|
const out = {};
|
|
@@ -5460,6 +6102,8 @@
|
|
|
5460
6102
|
? 'Workflow compiled. Review any notices above the canvas before running.'
|
|
5461
6103
|
: `Compiled, but ${app.notes.length} notice(s) remain — review them above the canvas.`);
|
|
5462
6104
|
showToast('Workflow compiled', 'ok');
|
|
6105
|
+
// #1998: a person just approved a workflow — the moment to ask, once, about small read-only tool fixes.
|
|
6106
|
+
maybeAskPolicyAfterApproval();
|
|
5463
6107
|
} catch (e) {
|
|
5464
6108
|
$compileBtn.textContent = prev;
|
|
5465
6109
|
$compileBtn.disabled = false;
|
|
@@ -5477,18 +6121,18 @@
|
|
|
5477
6121
|
if (!currentId || ($menuBakeItem && $menuBakeItem.disabled)) return;
|
|
5478
6122
|
const app = apps.get(currentId);
|
|
5479
6123
|
if (!app) return;
|
|
5480
|
-
document.getElementById('bake-title').textContent = app.baked ? 'Re-bake
|
|
6124
|
+
document.getElementById('bake-title').textContent = app.baked ? 'Re-bake tool' : 'Bake into tool';
|
|
5481
6125
|
const inps = app.inputs || [];
|
|
5482
6126
|
const inputsHtml = inps.length
|
|
5483
6127
|
? inps.map((i) => `<span class="ni-pair"><span class="ni-key">${escapeHtml(i.name)}</span><span class="ni-val">${escapeHtml(i.type)}</span></span>`).join('')
|
|
5484
|
-
: '<span class="bake-noinputs">No inputs — this
|
|
6128
|
+
: '<span class="bake-noinputs">No inputs — this tool is called with no parameters.</span>';
|
|
5485
6129
|
// Rebuild the whole body each open — a prior runBake() replaces it with the
|
|
5486
6130
|
// spinner (destroying #bake-name/#bake-inputs), so we can't assume they exist.
|
|
5487
6131
|
const $body = document.getElementById('bake-body');
|
|
5488
6132
|
$body.classList.remove('busy');
|
|
5489
6133
|
$body.innerHTML =
|
|
5490
|
-
`<div class="modal-field"><label>
|
|
5491
|
-
`<div class="modal-field"><label>
|
|
6134
|
+
`<div class="modal-field"><label>Tool name</label><div id="bake-name" class="bake-name"><code>${escapeHtml(app.id)}</code></div></div>` +
|
|
6135
|
+
`<div class="modal-field"><label>Tool inputs</label><div id="bake-inputs" class="bake-inputs">${inputsHtml}</div></div>`;
|
|
5492
6136
|
const $confirm = document.getElementById('bake-confirm');
|
|
5493
6137
|
const $cancel = document.getElementById('bake-cancel');
|
|
5494
6138
|
$confirm.disabled = false; $cancel.disabled = false;
|
|
@@ -5506,17 +6150,17 @@
|
|
|
5506
6150
|
$confirm.disabled = true; $cancel.disabled = true;
|
|
5507
6151
|
$confirm.textContent = '⊙ Baking…';
|
|
5508
6152
|
$body.classList.add('busy');
|
|
5509
|
-
$body.innerHTML = '<div class="bake-progress"><span class="rtn-spinner"></span><span>Reinstalling as
|
|
6153
|
+
$body.innerHTML = '<div class="bake-progress"><span class="rtn-spinner"></span><span>Reinstalling as a tool — this takes a few seconds…</span></div>';
|
|
5510
6154
|
try {
|
|
5511
6155
|
await api('/api/bake', { method: 'POST', body: JSON.stringify({ id }) });
|
|
5512
6156
|
hideModal($bakeModal);
|
|
5513
6157
|
await loadApp(id);
|
|
5514
|
-
appendNarration(`Baked <strong>${escapeHtml(id)}</strong> as a reusable
|
|
5515
|
-
showToast(`Baked — now in the
|
|
6158
|
+
appendNarration(`Baked <strong>${escapeHtml(id)}</strong> as a reusable tool — find it in the Tools library (<strong>≡ menu → Tools</strong>).`);
|
|
6159
|
+
showToast(`Baked — now in the Tools library as “${id}”`, 'ok');
|
|
5516
6160
|
} catch (e) {
|
|
5517
6161
|
hideModal($bakeModal);
|
|
5518
6162
|
// The server restores the original install on failure (recoverable) → warn, not err.
|
|
5519
|
-
showToast('We couldn’t save this as
|
|
6163
|
+
showToast('We couldn’t save this as a tool because FloLess could not finish the setup. Try again.', 'warn');
|
|
5520
6164
|
}
|
|
5521
6165
|
}
|
|
5522
6166
|
|
|
@@ -5614,10 +6258,11 @@
|
|
|
5614
6258
|
for (const control of [$graftPrimary, $graftBack, $graftCancel]) control.removeAttribute('data-blocked-reason');
|
|
5615
6259
|
$graftCancel.textContent = 'Cancel';
|
|
5616
6260
|
$graftCancel.setAttribute('data-command-id', 'shell.dialog-cancel#building an agent');
|
|
6261
|
+
$graftCancel.setAttribute('data-command-instance-label', 'building a tool');
|
|
5617
6262
|
const supported = prefill && GRAFT_KINDS.some((item) => item.kind === prefill.kind)
|
|
5618
6263
|
&& typeof prefill.ref === 'string' && prefill.ref.trim();
|
|
5619
6264
|
graftState = { kind: supported ? prefill.kind : 'dlls', ref: supported ? prefill.ref : '', decompile: false, showMore: false, preview: null, stagedRef: null, verifyInFlight: false, commitInFlight: false, probe: null, focusCheckRow: false, onPrimary: runGraftIntrospect, onBack: null };
|
|
5620
|
-
document.getElementById('graft-title').textContent = 'Graft into
|
|
6265
|
+
document.getElementById('graft-title').textContent = 'Graft into tool';
|
|
5621
6266
|
document.getElementById('graft-sub').textContent = 'Choose a DLL, package, or API spec. AWARE will inspect it and prepare command descriptions for your review.';
|
|
5622
6267
|
$graftBack.disabled = false; $graftCancel.disabled = false;
|
|
5623
6268
|
graftRenderPicker();
|
|
@@ -5749,7 +6394,7 @@
|
|
|
5749
6394
|
function graftRenderPreview(preview) {
|
|
5750
6395
|
clearGraftInstructorNote();
|
|
5751
6396
|
document.getElementById('graft-title').textContent = 'Review generated commands';
|
|
5752
|
-
document.getElementById('graft-sub').textContent = 'AWARE listed commands from this source. None has been run. Create the
|
|
6397
|
+
document.getElementById('graft-sub').textContent = 'AWARE listed commands from this source. None has been run. Create the tool only if you want it in your Tools library.';
|
|
5753
6398
|
const tekla = preview.recipe === 'tekla-plugin';
|
|
5754
6399
|
const badge = tekla
|
|
5755
6400
|
? '<div class="graft-badge tekla">⊕ Tekla plug-in recipe</div>'
|
|
@@ -5772,14 +6417,14 @@
|
|
|
5772
6417
|
&& /[\\/]Tekla\.Structures\.Model\.dll$/i.test(preview.sourceRef);
|
|
5773
6418
|
const verify = modelRead
|
|
5774
6419
|
? `<div class="graft-read-review"><strong>Check one live Tekla read</strong>` +
|
|
5775
|
-
`<p id="graft-verify-help">This reads the open model name using the selected library. It does not test the generated
|
|
6420
|
+
`<p id="graft-verify-help">This reads the open model name using the selected library. It does not test the generated tool or its other commands.</p>` +
|
|
5776
6421
|
`<dl class="graft-identity"><dt>Library</dt><dd>${escapeHtml(preview.sourceRef)}</dd>` +
|
|
5777
6422
|
`<dt>Operation</dt><dd>Model.GetInfo().ModelName</dd></dl>` +
|
|
5778
6423
|
`<button type="button" class="graft-verify-button" id="graft-verify-read" data-command-id="shell.graft-verify-tekla-read" aria-describedby="graft-verify-help">Verify model read</button>` +
|
|
5779
6424
|
`<div id="graft-verify-result" role="status" aria-live="polite"></div></div>` : '';
|
|
5780
6425
|
graftFill(graftBodyEl(),
|
|
5781
6426
|
badge + hero + verify + graftConnectionHtml(preview) + warnings + cmds + skills +
|
|
5782
|
-
`<div class="modal-field"><label>
|
|
6427
|
+
`<div class="modal-field"><label>Tool name</label><div class="bake-name"><code>${escapeHtml(preview.agentId)}</code></div></div>`);
|
|
5783
6428
|
const verifyButton = document.getElementById('graft-verify-read');
|
|
5784
6429
|
verifyButton?.addEventListener('click', () => runGraftVerifyRead(preview));
|
|
5785
6430
|
wireGraftAddCheck(preview);
|
|
@@ -5791,7 +6436,7 @@
|
|
|
5791
6436
|
}
|
|
5792
6437
|
graftState.onBack = graftRenderPicker;
|
|
5793
6438
|
graftState.onPrimary = () => runGraftCommit(false);
|
|
5794
|
-
graftFooter({ backShown: true, primaryLabel: 'Create
|
|
6439
|
+
graftFooter({ backShown: true, primaryLabel: 'Create tool', primaryDisabled: preview.commands.length === 0, primaryCommand: 'shell.graft-create-agent' });
|
|
5795
6440
|
}
|
|
5796
6441
|
|
|
5797
6442
|
/** What the tool needs to connect, and its connection check (#1899). Plain words, no internals. */
|
|
@@ -5933,7 +6578,7 @@
|
|
|
5933
6578
|
receiptHost.setAttribute('role', 'status');
|
|
5934
6579
|
if (preview?.probe && window.flolessConnections) {
|
|
5935
6580
|
actions.append(window.flolessConnections.checkButton({
|
|
5936
|
-
agent: agentId, label: agentId, receiptHost, confirmHost, announce: (text) => { status.textContent = text; },
|
|
6581
|
+
commandId: 'shell.graft-connection-check', agent: agentId, label: agentId, receiptHost, confirmHost, announce: (text) => { status.textContent = text; },
|
|
5937
6582
|
}));
|
|
5938
6583
|
}
|
|
5939
6584
|
if (!actions.childElementCount && !needs.length) return null;
|
|
@@ -5998,7 +6643,7 @@
|
|
|
5998
6643
|
`<dt>Tekla host</dt><dd>${escapeHtml(proof.hostVersion)} · PID ${escapeHtml(String(proof.hostPid))}</dd>` +
|
|
5999
6644
|
`<dt>Library used</dt><dd>${escapeHtml(proof.sourcePath)}</dd>` +
|
|
6000
6645
|
`<dt>Checked</dt><dd>${escapeHtml(proof.verifiedAt)}</dd></dl>` +
|
|
6001
|
-
`<p>The generated
|
|
6646
|
+
`<p>The generated tool's commands remain unverified.</p>` +
|
|
6002
6647
|
`<button type="button" class="graft-verify-button graft-continue-chat" id="graft-continue-chat" data-command-id="shell.graft-continue-chat">Continue in AI Chat</button></div>`);
|
|
6003
6648
|
// Only the successful receipt carries this action. It hands the receipt to Chat as an
|
|
6004
6649
|
// editable, unsent draft; opening Chat never re-runs the Tekla read.
|
|
@@ -6021,6 +6666,7 @@
|
|
|
6021
6666
|
$graftBack.removeAttribute('data-blocked-reason');
|
|
6022
6667
|
$graftCancel.textContent = 'Cancel';
|
|
6023
6668
|
$graftCancel.setAttribute('data-command-id', 'shell.dialog-cancel#building an agent');
|
|
6669
|
+
$graftCancel.setAttribute('data-command-instance-label', 'building a tool');
|
|
6024
6670
|
if ($graftInstructorNote.dataset.commandId) {
|
|
6025
6671
|
const focused = document.activeElement;
|
|
6026
6672
|
if (![button, $graftCancel, $graftPrimary, $graftBack].includes(focused) || !window.Instructor?.refreshCarrier(focused)) clearGraftInstructorNote();
|
|
@@ -6062,23 +6708,23 @@
|
|
|
6062
6708
|
primaryCommand: force ? 'shell.graft-overwrite-agent' : 'shell.graft-create-agent' });
|
|
6063
6709
|
$graftBack.disabled = true; $graftCancel.disabled = true;
|
|
6064
6710
|
for (const control of [$graftPrimary, $graftBack, $graftCancel]) {
|
|
6065
|
-
control.setAttribute('data-blocked-reason', '
|
|
6711
|
+
control.setAttribute('data-blocked-reason', 'Tool creation is in progress. Wait for it to finish.');
|
|
6066
6712
|
}
|
|
6067
6713
|
const verifyButton = document.getElementById('graft-verify-read');
|
|
6068
6714
|
if (verifyButton) {
|
|
6069
6715
|
verifyButton.disabled = true;
|
|
6070
|
-
verifyButton.setAttribute('data-blocked-reason', '
|
|
6716
|
+
verifyButton.setAttribute('data-blocked-reason', 'Tool creation is in progress. Wait for it to finish.');
|
|
6071
6717
|
}
|
|
6072
6718
|
const continueButton = document.getElementById('graft-continue-chat');
|
|
6073
6719
|
if (continueButton) {
|
|
6074
6720
|
continueButton.disabled = true;
|
|
6075
|
-
continueButton.setAttribute('data-blocked-reason', '
|
|
6721
|
+
continueButton.setAttribute('data-blocked-reason', 'Tool creation is in progress. Wait for it to finish.');
|
|
6076
6722
|
}
|
|
6077
6723
|
try {
|
|
6078
6724
|
const body = { stagedRef: graftState.stagedRef };
|
|
6079
6725
|
if (force) body.force = true;
|
|
6080
6726
|
const res = await api('/api/graft/commit', { method: 'POST', body: JSON.stringify(body) });
|
|
6081
|
-
graftFill(graftBodyEl(), `<div class="graft-success"><div class="gs-icon">⊕</div><div class="gs-msg" id="graft-success-msg" tabindex="-1">
|
|
6727
|
+
graftFill(graftBodyEl(), `<div class="graft-success"><div class="gs-icon">⊕</div><div class="gs-msg" id="graft-success-msg" tabindex="-1">Tool created — now in the Tools library as <code>${escapeHtml(res.agentId)}</code>.</div></div>`);
|
|
6082
6728
|
const nextSteps = graftSuccessActions(graftState.preview, res.agentId);
|
|
6083
6729
|
if (nextSteps) graftBodyEl().append(nextSteps);
|
|
6084
6730
|
document.getElementById('graft-success-msg')?.focus();
|
|
@@ -6086,8 +6732,8 @@
|
|
|
6086
6732
|
$graftPrimary.setAttribute('data-command-id', 'shell.graft-done');
|
|
6087
6733
|
graftState.onPrimary = closeGraftModal;
|
|
6088
6734
|
loadAgentCatalog().catch(() => {}); // refresh count immediately (SSE also fires for other tabs)
|
|
6089
|
-
appendNarration(`Grafted <strong>${escapeHtml(res.agentId)}</strong> from ${escapeHtml(graftState.preview.sourceRef)} — find it in the
|
|
6090
|
-
showToast(`
|
|
6735
|
+
appendNarration(`Grafted <strong>${escapeHtml(res.agentId)}</strong> from ${escapeHtml(graftState.preview.sourceRef)} — find it in the Tools library (<strong>≡ menu → Tools</strong>).`);
|
|
6736
|
+
showToast(`Tool created — “${res.agentId}” is now in the Tools library`, 'ok');
|
|
6091
6737
|
} catch (e) {
|
|
6092
6738
|
$graftBack.disabled = false; $graftCancel.disabled = false;
|
|
6093
6739
|
const msg = (e && e.message) ? e.message : 'Create failed';
|
|
@@ -6102,9 +6748,9 @@
|
|
|
6102
6748
|
graftBodyEl().prepend(warn);
|
|
6103
6749
|
}
|
|
6104
6750
|
} else {
|
|
6105
|
-
graftFooter({ backShown: true, primaryLabel: 'Create
|
|
6751
|
+
graftFooter({ backShown: true, primaryLabel: 'Create tool', primaryDisabled: false, primaryCommand: 'shell.graft-create-agent' });
|
|
6106
6752
|
graftState.onPrimary = () => runGraftCommit(false);
|
|
6107
|
-
showToast('We couldn’t create this
|
|
6753
|
+
showToast('We couldn’t create this tool because FloLess could not finish the setup. Try again.', 'warn');
|
|
6108
6754
|
}
|
|
6109
6755
|
} finally {
|
|
6110
6756
|
state.commitInFlight = false;
|
|
@@ -6272,7 +6918,7 @@
|
|
|
6272
6918
|
if (!el) return;
|
|
6273
6919
|
el.className = `import-failed-agent-status is-${state}`;
|
|
6274
6920
|
el.textContent = state === 'updated' ? `✓ Updated to v${detail}`
|
|
6275
|
-
: state === 'current' ? 'Nothing to update — already the latest version. This
|
|
6921
|
+
: state === 'current' ? 'Nothing to update — already the latest version. This tool hasn’t been released as runnable yet.'
|
|
6276
6922
|
// We captured no "before" version, so we cannot honestly claim a change happened. Report what
|
|
6277
6923
|
// AWARE now has and say nothing we do not know.
|
|
6278
6924
|
: state === 'done' ? `AWARE finished — it reports v${detail || '?'} installed.`
|
|
@@ -6321,9 +6967,9 @@
|
|
|
6321
6967
|
// (the case in #314), versus one upstream has genuinely not shipped a runnable build for yet.
|
|
6322
6968
|
// Promising a fix that then changes nothing is worse than the honest "we don't know" tier.
|
|
6323
6969
|
$sub.textContent = agents.length === 1
|
|
6324
|
-
? `This workflow needs the ${named}
|
|
6325
|
-
+ ' Updating usually fixes it. If there is nothing to update, that
|
|
6326
|
-
: `This workflow needs ${agents.length}
|
|
6970
|
+
? `This workflow needs the ${named} tool, which isn’t runnable yet on this machine.`
|
|
6971
|
+
+ ' Updating usually fixes it. If there is nothing to update, that tool hasn’t been released yet — this workflow can’t run here until it is.'
|
|
6972
|
+
: `This workflow needs ${agents.length} tools that aren’t runnable yet on this machine: ${named}.`
|
|
6327
6973
|
+ ' Updating usually fixes it. Any that report nothing to update haven’t been released yet — this workflow can’t run here until they are.';
|
|
6328
6974
|
$rows.append(...agents.map(importFailedCmdRow)); // one command per agent, never a guessed multi-agent form
|
|
6329
6975
|
// ONE retry offer for the whole dialog, not one per row: "retry THE import" is singular, and N
|
|
@@ -8005,6 +8651,11 @@
|
|
|
8005
8651
|
} else {
|
|
8006
8652
|
// A failed run is an expected, recoverable outcome (the server returns it
|
|
8007
8653
|
// in-band) — surface it as a toast + narration, not a console error.
|
|
8654
|
+
// (#1996 E2E: `msg` was never defined here, so every refused run threw a ReferenceError and the
|
|
8655
|
+
// person saw nothing — the node stayed "running".)
|
|
8656
|
+
const msg = e && e.message ? e.message : String(e);
|
|
8657
|
+
// #1998: AWARE refused before anything started (an approval it will not run): no node is "running".
|
|
8658
|
+
if (e && e.body && e.body.refusal) clearNodeStatus();
|
|
8008
8659
|
showToast((simulate ? 'Simulate failed' : 'Run failed') + ': ' + runFailureMessage(msg), 'warn');
|
|
8009
8660
|
appendNarration(simulate
|
|
8010
8661
|
? `Simulate couldn't validate <code>${escapeHtml(currentId)}</code> — it stubs each node from its output-schema, but exec nodes have none, so the cross-node templates render undefined. Use <strong>▶ Run workflow</strong> for a live run against the host.`
|
|
@@ -8076,7 +8727,7 @@
|
|
|
8076
8727
|
let lvl = 'info';
|
|
8077
8728
|
let msg;
|
|
8078
8729
|
switch (ev.kind) {
|
|
8079
|
-
case 'run-start': msg = `run start · ${escapeHtml(ev.app || '')} (${escapeHtml(ev.instance || 'default')})`; break;
|
|
8730
|
+
case 'run-start': msg = `run start · ${escapeHtml(ev.app || '')} (${escapeHtml(ev.instance || 'default')})${runStartApprovalNote(ev)}`; break;
|
|
8080
8731
|
case 'node-start': lvl = 'event'; msg = `node ${node} · ${agent}${cmd}`; break;
|
|
8081
8732
|
case 'would-write': lvl = 'warn'; msg = `would-write ${node} · ${escapeHtml(JSON.stringify(ev.proposed_inputs || {}))}`; break;
|
|
8082
8733
|
case 'node-output': case 'output': case 'write': lvl = 'ok'; msg = `${escapeHtml(ev.kind)} ${node}`.trim(); break;
|
|
@@ -8746,6 +9397,9 @@
|
|
|
8746
9397
|
state.hasRun = true;
|
|
8747
9398
|
} else if (m.type === 'templates-changed') {
|
|
8748
9399
|
loadTemplates().catch(() => {});
|
|
9400
|
+
} else if (m.type === 'tool-updates-changed') {
|
|
9401
|
+
// #1997: relayed for tool-updates.js (the footer pill + Approve updated workflows), its only listener.
|
|
9402
|
+
window.dispatchEvent(new CustomEvent('floless:tool-updates-changed', { detail: m }));
|
|
8749
9403
|
} else if (m.type === 'apps-changed') {
|
|
8750
9404
|
// A workflow was imported (here or in another tab) → refresh the picker (#66).
|
|
8751
9405
|
loadApps().catch(() => {});
|
|
@@ -8897,7 +9551,10 @@
|
|
|
8897
9551
|
// apps-changed handler already refreshes the picker, and reloading a gone id
|
|
8898
9552
|
// would 404. dropClientAppState() removes it from `apps` before this fires.
|
|
8899
9553
|
if (!currentId || !apps.has(currentId)) return;
|
|
8900
|
-
|
|
9554
|
+
// #1890 PR 3b-0: an owned workflow's installed copy can vanish (uninstalled outside FloLess); the refresh
|
|
9555
|
+
// decides — reloading it if still installed, its recovery view if not — so a gone copy is never fetched.
|
|
9556
|
+
if (ownedWorkflowOf(currentId)) loadApps().catch(reportErr);
|
|
9557
|
+
else loadApp(currentId).catch(reportErr);
|
|
8901
9558
|
}, 250);
|
|
8902
9559
|
} else if (m.type === 'seat-taken') {
|
|
8903
9560
|
// This session's seat was lost. m.reason (normalized server-side) says why — only a
|
|
@@ -10683,6 +11340,123 @@
|
|
|
10683
11340
|
*/
|
|
10684
11341
|
const AUDIT_OWNER_ORDER = { user: 0, reader: 1, server: 2, none: 3, unknown: 4 };
|
|
10685
11342
|
|
|
11343
|
+
/**
|
|
11344
|
+
* #1874 — a drawing read whose discard record cannot be read. It used to vanish from Requests; now it
|
|
11345
|
+
* stays, every ordinary action is withheld (the server stamps them off), and the person decides here.
|
|
11346
|
+
* Keep is the primary choice because it can be undone; Discard asks once more before it removes
|
|
11347
|
+
* anything. A Discard that was cut short is only offered as "finish": part of the read may be gone.
|
|
11348
|
+
*/
|
|
11349
|
+
function requestHasDiscardQuestion(r) {
|
|
11350
|
+
return !!r && r.type === 'revision-read' && !!r.discardRecordUnreadable;
|
|
11351
|
+
}
|
|
11352
|
+
|
|
11353
|
+
function discardRecordQuestionHtml(r, commandInstance) {
|
|
11354
|
+
if (!requestHasDiscardQuestion(r)) return '';
|
|
11355
|
+
const id = escapeAttr(r.id);
|
|
11356
|
+
const leadId = `req-discard-q-${id}`;
|
|
11357
|
+
const finishing = r.discardRecordRecovery?.choice === 'discarding';
|
|
11358
|
+
const lead = finishing
|
|
11359
|
+
? 'FloLess was part-way through discarding this read.'
|
|
11360
|
+
: 'We couldn’t tell if this read was discarded.';
|
|
11361
|
+
const body = finishing
|
|
11362
|
+
? 'You chose to discard it and some of its files may already be gone, so it can’t be carried on. Finish discarding it.'
|
|
11363
|
+
: (r.discardRecordUnreadable.kind === 'unopenable'
|
|
11364
|
+
? 'FloLess couldn’t open its discard record, so it left the read as it is. It checks again whenever Requests refreshes.'
|
|
11365
|
+
: 'Its discard record is damaged, so FloLess left the read as it is.')
|
|
11366
|
+
+ ' Keep it to carry on where you left off, or discard it if you’d already thrown it away.';
|
|
11367
|
+
// The step lives outside the DOM: the list repaints on every poll, and a confirmation or a request in
|
|
11368
|
+
// flight must survive that rather than silently snapping back to the first question.
|
|
11369
|
+
const ui = discardRecordUi.get(r.id) || {};
|
|
11370
|
+
const busy = ui.step === 'keeping' || ui.step === 'discarding';
|
|
11371
|
+
// Shared tail of every button: who it names for Instructor, and its busy state.
|
|
11372
|
+
const rest = (kind) => `data-id="${id}" data-command-instance-label="${escapeAttr(commandInstance)}"${busy ? ' disabled' : ''}${busy && ui.pressed === kind ? ' aria-busy="true"' : ''}`;
|
|
11373
|
+
const confirming = ui.step === 'confirm' || ui.step === 'discarding';
|
|
11374
|
+
const actions = confirming
|
|
11375
|
+
? `<button type="button" class="req-chat-action" data-discard-record="cancel" data-command-id="shell.requests-discard-record-cancel#${escapeAttr(r.id)}" ${rest('cancel')}>Cancel</button>`
|
|
11376
|
+
+ `<button type="button" class="req-chat-action danger" data-discard-record="discard" data-command-id="shell.requests-discard-record-confirm#${escapeAttr(r.id)}" ${rest('discard')}>${ui.step === 'discarding' ? 'Discarding…' : 'Discard for good'}</button>`
|
|
11377
|
+
: (finishing ? '' : `<button type="button" class="req-chat-action primary" data-discard-record="keep" data-command-id="shell.requests-discard-record-keep#${escapeAttr(r.id)}" data-tip="Carry on with this read. The unreadable record is kept for diagnosis, not deleted." ${rest('keep')}>${ui.step === 'keeping' ? 'Keeping…' : 'Keep this read'}</button>`)
|
|
11378
|
+
+ `<button type="button" class="req-chat-action" data-discard-record="ask" data-command-id="shell.requests-discard-record-discard#${escapeAttr(r.id)}" data-tip="Remove this read and its working files" ${rest('ask')}>${finishing ? 'Finish discarding' : 'Discard…'}</button>`;
|
|
11379
|
+
const status = ui.status || (confirming ? 'Discard this read for good? This can’t be undone.' : '');
|
|
11380
|
+
return `<div class="req-discard-q" role="group" aria-labelledby="${leadId}">
|
|
11381
|
+
<p class="req-discard-q-lead" id="${leadId}">${escapeHtml(lead)}</p>
|
|
11382
|
+
<p class="req-discard-q-body">${escapeHtml(body)}</p>
|
|
11383
|
+
<div class="req-discard-q-actions">${actions}</div>
|
|
11384
|
+
<p class="req-discard-q-status" role="status" aria-live="polite">${escapeHtml(status)}</p>
|
|
11385
|
+
</div>`;
|
|
11386
|
+
}
|
|
11387
|
+
|
|
11388
|
+
function discardRecordKeptNoteHtml(r) {
|
|
11389
|
+
const recovery = r && r.type === 'revision-read' && !requestHasDiscardQuestion(r) ? r.discardRecordRecovery : null;
|
|
11390
|
+
if (!recovery || recovery.choice !== 'kept') return '';
|
|
11391
|
+
const missing = Number(recovery.missingAttachments) || 0;
|
|
11392
|
+
const extra = missing ? ` ${missing === 1 ? '1 attached drawing was' : `${missing} attached drawings were`} already missing.` : '';
|
|
11393
|
+
return `<p class="req-discard-kept">Kept after its discard record couldn’t be read.${escapeHtml(extra)}</p>`;
|
|
11394
|
+
}
|
|
11395
|
+
|
|
11396
|
+
/** Per-read step of the question above: `confirm`, `keeping`, `discarding`, plus a failure sentence. */
|
|
11397
|
+
const discardRecordUi = new Map();
|
|
11398
|
+
|
|
11399
|
+
function focusDiscardRecordControl(id, kind) {
|
|
11400
|
+
const el = document.querySelector(`#requests-list [data-discard-record="${kind}"][data-id="${CSS.escape(id)}"]`);
|
|
11401
|
+
if (el) el.focus();
|
|
11402
|
+
return !!el;
|
|
11403
|
+
}
|
|
11404
|
+
|
|
11405
|
+
async function sendDiscardRecordChoice(id, choice) {
|
|
11406
|
+
discardRecordUi.set(id, { step: choice === 'keep' ? 'keeping' : 'discarding', pressed: choice === 'keep' ? 'keep' : 'discard' });
|
|
11407
|
+
renderRequests();
|
|
11408
|
+
let said;
|
|
11409
|
+
try {
|
|
11410
|
+
const res = await api(`/api/requests/${encodeURIComponent(id)}/discard-record`, {
|
|
11411
|
+
method: 'POST', body: JSON.stringify({ choice }),
|
|
11412
|
+
});
|
|
11413
|
+
said = res?.outcome === 'kept' ? 'Read kept.'
|
|
11414
|
+
: res?.outcome === 'discarded' ? 'Read discarded.'
|
|
11415
|
+
: res?.outcome === 'already-discarded' ? 'Its discard record could be read again: this read had been discarded.'
|
|
11416
|
+
: 'Its discard record could be read again, so there was nothing to decide.';
|
|
11417
|
+
discardRecordUi.delete(id);
|
|
11418
|
+
} catch (error) {
|
|
11419
|
+
discardRecordUi.set(id, { status: error?.message || 'That didn’t work. Try again.' });
|
|
11420
|
+
await loadRequests().catch(() => {});
|
|
11421
|
+
renderRequests();
|
|
11422
|
+
focusDiscardRecordControl(id, choice === 'keep' ? 'keep' : 'ask');
|
|
11423
|
+
return;
|
|
11424
|
+
}
|
|
11425
|
+
await loadRequests().catch(() => {});
|
|
11426
|
+
renderRequests();
|
|
11427
|
+
const actionStatus = document.getElementById('requests-action-status');
|
|
11428
|
+
if (actionStatus) actionStatus.textContent = said;
|
|
11429
|
+
// The question is gone either way; land focus on the kept row, or on the list, never on <body>.
|
|
11430
|
+
const row = document.querySelector(`#requests-list .req-item[data-id="${CSS.escape(id)}"]`);
|
|
11431
|
+
const target = row || document.getElementById('requests-list');
|
|
11432
|
+
if (target) {
|
|
11433
|
+
if (!target.hasAttribute('tabindex')) target.setAttribute('tabindex', '-1');
|
|
11434
|
+
target.focus();
|
|
11435
|
+
}
|
|
11436
|
+
}
|
|
11437
|
+
|
|
11438
|
+
function wireDiscardRecordQuestions($list) {
|
|
11439
|
+
$list.querySelectorAll('[data-discard-record]').forEach((button) => {
|
|
11440
|
+
const id = button.dataset.id;
|
|
11441
|
+
const kind = button.dataset.discardRecord;
|
|
11442
|
+
button.onclick = () => {
|
|
11443
|
+
if (kind === 'keep') return void sendDiscardRecordChoice(id, 'keep');
|
|
11444
|
+
if (kind === 'discard') return void sendDiscardRecordChoice(id, 'discard');
|
|
11445
|
+
if (kind === 'ask') {
|
|
11446
|
+
// A second, explicit step: Discard removes the read for good. Cancel takes focus so Enter is safe.
|
|
11447
|
+
discardRecordUi.set(id, { step: 'confirm' });
|
|
11448
|
+
renderRequests();
|
|
11449
|
+
focusDiscardRecordControl(id, 'cancel');
|
|
11450
|
+
return undefined;
|
|
11451
|
+
}
|
|
11452
|
+
discardRecordUi.delete(id);
|
|
11453
|
+
renderRequests();
|
|
11454
|
+
focusDiscardRecordControl(id, 'ask');
|
|
11455
|
+
return undefined;
|
|
11456
|
+
};
|
|
11457
|
+
});
|
|
11458
|
+
}
|
|
11459
|
+
|
|
10686
11460
|
function auditRefusalHtml(r) {
|
|
10687
11461
|
const retry = r && r.auditRetry;
|
|
10688
11462
|
if (!retry || !Object.prototype.hasOwnProperty.call(AUDIT_REFUSAL_LEAD, retry.code)) return '';
|
|
@@ -10735,6 +11509,8 @@
|
|
|
10735
11509
|
/** One exact next step above the request rows; automatic start is offered only when policy allows it. */
|
|
10736
11510
|
function drawingRequestGuidance(r) {
|
|
10737
11511
|
if (!r) return '';
|
|
11512
|
+
// #1874: the row's own question is the only next step; "copy this request" would contradict it.
|
|
11513
|
+
if (requestHasDiscardQuestion(r)) return '';
|
|
10738
11514
|
if (r.status && r.status !== 'pending') return '';
|
|
10739
11515
|
if (r.preparationState === 'blocked') {
|
|
10740
11516
|
return 'FloLess could not finish drawing preparation. Restart FloLess; if this remains blocked, open the detailed instructions in Requests. Your drawings are still attached. Do not retry, copy, clear, or attach them again.';
|
|
@@ -11179,6 +11955,8 @@
|
|
|
11179
11955
|
// ✕ goes away while a run is live, for the same reason it goes away on a knowledge-organize:
|
|
11180
11956
|
// deleting the request out from under a working agent leaves it unable to clear its own work,
|
|
11181
11957
|
// and the run then lands in `exited-unresolved` for a reason the user caused and cannot see.
|
|
11958
|
+
// #1874: a read nobody can say is discarded or not offers only Keep / Discard, in its own block.
|
|
11959
|
+
const discardQuestion = requestHasDiscardQuestion(r);
|
|
11182
11960
|
const del = lifecycleOwned
|
|
11183
11961
|
? '<span class="req-lifecycle" data-tip="This clears itself when your terminal AI finishes or fails the organize">finishing in your terminal</span>'
|
|
11184
11962
|
: inFlight || desktopClaimed
|
|
@@ -11212,14 +11990,14 @@
|
|
|
11212
11990
|
const inChatScope = hasChatOwner && requestMatchesChatScope(r);
|
|
11213
11991
|
const chatLabel = `${label}${owner ? ` for ${owner}` : ''}`;
|
|
11214
11992
|
const hasLinkedChat = Boolean(r.chatConversation?.chatId);
|
|
11215
|
-
const discussBtn = chatProvider && inChatScope
|
|
11993
|
+
const discussBtn = chatProvider && inChatScope && !discardQuestion
|
|
11216
11994
|
? `<button class="req-chat-action" data-request-chat="discuss" data-id="${escapeAttr(r.id)}" data-command-id="shell.requests-discuss#${escapeAttr(r.id)}" data-command-instance-label="${escapeAttr(commandInstance)}" aria-label="${hasLinkedChat ? 'Open' : 'Discuss'} ${escapeAttr(chatLabel)} in AI Chat" data-tip="${hasLinkedChat ? 'Open the linked conversation in AI Chat' : 'Open this request in AI Chat without starting the AI'}">${hasLinkedChat ? 'Open AI Chat' : 'Discuss in AI Chat'}</button>`
|
|
11217
11995
|
: '';
|
|
11218
11996
|
const starting = requestChatStarts.get(r.id)?.label;
|
|
11219
11997
|
const startChatBtn = chatProvider && inChatScope && canRunNow && !filterGuide
|
|
11220
11998
|
? `<button class="req-chat-action primary" data-request-chat="start" data-id="${escapeAttr(r.id)}" data-command-id="shell.requests-start-chat#${escapeAttr(r.id)}" data-command-instance-label="${escapeAttr(commandInstance)}" aria-label="Start ${escapeAttr(chatLabel)} in AI Chat" data-tip="Start this request in AI Chat and continue there"${starting ? ' disabled aria-busy="true"' : ''}>${escapeHtml(starting || 'Start in AI Chat')}</button>`
|
|
11221
11999
|
: '';
|
|
11222
|
-
const chatMeta = chatProvider && inChatScope
|
|
12000
|
+
const chatMeta = discardQuestion ? '' : chatProvider && inChatScope
|
|
11223
12001
|
? `<span class="req-chat-meta">AI Chat · ${escapeHtml(runtimeLabel(chatProvider))} · ${r.type === 'guide' || (r.type === 'tweak-contract' && r.mode === 'query') ? 'Read only' : 'Working folder write'}</span>`
|
|
11224
12002
|
: chatProvider && hasChatOwner
|
|
11225
12003
|
? `<span class="req-chat-elsewhere" data-tip="Open ${escapeAttr(owner)} to discuss or start this request in AI Chat">Open ${escapeHtml(owner)} for AI Chat</span>`
|
|
@@ -11237,14 +12015,16 @@
|
|
|
11237
12015
|
${runStatusHtml(run, resumeCommand, desktopHandoffs, r.id, commandInstance, ownRecoverySurface,
|
|
11238
12016
|
filterGuide
|
|
11239
12017
|
? (r.instructorContext.commandId === 'filter.ask-ai-change' ? 'change' : 'question') : null, r.filterAiNotStarted === true)}
|
|
11240
|
-
${r.status === 'pending' && !revisionReadHasTerminalOwner(r) && !r.canRun && r.runWhy && (anyRunnable || r.type === 'revision-read') ? `<div class="req-why-not">Why there is no automatic start: ${escapeHtml(r.runWhy)}</div>` : ''}
|
|
12018
|
+
${!discardQuestion && r.status === 'pending' && !revisionReadHasTerminalOwner(r) && !r.canRun && r.runWhy && (anyRunnable || r.type === 'revision-read') ? `<div class="req-why-not">Why there is no automatic start: ${escapeHtml(r.runWhy)}</div>` : ''}
|
|
11241
12019
|
${auditRefusalHtml(r)}
|
|
12020
|
+
${discardRecordQuestionHtml(r, commandInstance)}
|
|
12021
|
+
${discardRecordKeptNoteHtml(r)}
|
|
11242
12022
|
</div>
|
|
11243
12023
|
<div class="req-actions">${chatMeta}
|
|
11244
12024
|
${discussBtn}
|
|
11245
12025
|
${runBtn}
|
|
11246
12026
|
${desktopHandoffs || resumeCommand || !requestCanCopy(r) ? '' : `<button class="req-copy" data-id="${escapeAttr(r.id)}" data-command-id="shell.requests-copy#${escapeAttr(r.id)}" data-command-instance-label="${escapeAttr(commandInstance)}" data-tip="${r.preparationRetryable ? 'Copy this retry request for your terminal AI' : 'Copy this request for your terminal AI'}" aria-label="${r.preparationRetryable ? 'Copy retry request' : 'Copy this request for your terminal AI'}">⧉</button>`}
|
|
11247
|
-
${del.replace('<button class="req-del"', '<button aria-label="Clear this request" class="req-del"')}
|
|
12027
|
+
${discardQuestion ? '' : del.replace('<button class="req-del"', '<button aria-label="Clear this request" class="req-del"')}
|
|
11248
12028
|
${startChatBtn}
|
|
11249
12029
|
</div>
|
|
11250
12030
|
</div>`;
|
|
@@ -11451,6 +12231,7 @@
|
|
|
11451
12231
|
};
|
|
11452
12232
|
});
|
|
11453
12233
|
$list.querySelectorAll('.req-del').forEach((b) => { b.onclick = () => deleteOneRequest(b.dataset.id); });
|
|
12234
|
+
wireDiscardRecordQuestions($list);
|
|
11454
12235
|
$list.querySelectorAll('.req-thumb').forEach((b) => {
|
|
11455
12236
|
b.onclick = () => window.open(`/api/requests/${encodeURIComponent(b.dataset.id)}/snapshot/${b.dataset.n}`, '_blank');
|
|
11456
12237
|
});
|
|
@@ -11682,12 +12463,22 @@
|
|
|
11682
12463
|
refreshAgentNotes();
|
|
11683
12464
|
}
|
|
11684
12465
|
|
|
11685
|
-
|
|
12466
|
+
// `focusId` (a connection check's "Update" offer, #1986): open on top of the dialog that asked, showing just that
|
|
12467
|
+
// tool on the Installed tab, where its own Update button lives — the update itself stays the library's.
|
|
12468
|
+
let libOpener = null; // the offer button that opened the library on top of its dialog, to return focus to
|
|
12469
|
+
openLibrary = function openLibraryReal(focusId) {
|
|
12470
|
+
const focus = typeof focusId === 'string' ? focusId : '';
|
|
12471
|
+
$libModal.classList.toggle('lib-front', !!focus);
|
|
12472
|
+
libOpener = focus ? document.activeElement : null;
|
|
11686
12473
|
$libSearch.value = '';
|
|
11687
12474
|
if ($libAvailSearch) $libAvailSearch.value = '';
|
|
11688
12475
|
switchLibTab('installed'); // always open on Installed (the primary job)
|
|
12476
|
+
$libSearch.value = focus;
|
|
11689
12477
|
renderLibrary();
|
|
11690
12478
|
$libModal.classList.add('show');
|
|
12479
|
+
// Focus moves into the library NOW (not on the tab switch's next tick), so even an immediate Escape lands on the
|
|
12480
|
+
// library's own handler instead of the dialog underneath.
|
|
12481
|
+
if (focus) $libSearch.focus();
|
|
11691
12482
|
if (!agentCatalog.length) loadAgentCatalog().then(renderLibrary).catch(reportErr);
|
|
11692
12483
|
// Load the registry catalog too, so the Installed tab can flag outdated agents
|
|
11693
12484
|
// with an "Update" button (and the Available tab is instant when switched to).
|
|
@@ -11697,6 +12488,23 @@
|
|
|
11697
12488
|
});
|
|
11698
12489
|
};
|
|
11699
12490
|
|
|
12491
|
+
// Opened on top of another dialog: Escape closes ONLY the library (the document-level Escape handlers would also
|
|
12492
|
+
// close Integrations), and focus goes back to the button that opened it.
|
|
12493
|
+
const closeFrontLibrary = () => {
|
|
12494
|
+
$libModal.classList.remove('show', 'lib-front');
|
|
12495
|
+
const opener = libOpener;
|
|
12496
|
+
libOpener = null;
|
|
12497
|
+
if (opener && opener.isConnected && typeof opener.focus === 'function') opener.focus();
|
|
12498
|
+
};
|
|
12499
|
+
$libModal.addEventListener('keydown', (e) => {
|
|
12500
|
+
if (e.key !== 'Escape' || !$libModal.classList.contains('lib-front')) return;
|
|
12501
|
+
e.stopPropagation();
|
|
12502
|
+
closeFrontLibrary();
|
|
12503
|
+
});
|
|
12504
|
+
document.getElementById('lib-close')?.addEventListener('click', () => {
|
|
12505
|
+
if ($libModal.classList.contains('lib-front')) closeFrontLibrary();
|
|
12506
|
+
});
|
|
12507
|
+
|
|
11700
12508
|
// Compare two dotted version strings numerically, segment by segment (missing
|
|
11701
12509
|
// segments = 0). Returns 1 if a>b, -1 if a<b, 0 if equal — so the Installed tab
|
|
11702
12510
|
// only offers an "Update" when the registry is STRICTLY ahead (never a downgrade).
|
|
@@ -11756,7 +12564,7 @@
|
|
|
11756
12564
|
<div class="lib-item">
|
|
11757
12565
|
<div class="info">
|
|
11758
12566
|
<div class="name">${escapeHtml(a.id)}</div>
|
|
11759
|
-
<div class="meta"><span class="lib-ver">v${escapeHtml(String(a.version))}</span> ${escapeHtml(a.kind || '
|
|
12567
|
+
<div class="meta"><span class="lib-ver">v${escapeHtml(String(a.version))}</span> ${escapeHtml(a.kind || 'tool')} · ${a.commands} command${a.commands === 1 ? '' : 's'} · ${a.skills} skill${a.skills === 1 ? '' : 's'}</div>
|
|
11760
12568
|
</div>
|
|
11761
12569
|
<div class="lib-actions">
|
|
11762
12570
|
${updateBtn}
|
|
@@ -11766,7 +12574,7 @@
|
|
|
11766
12574
|
${failureHtml}
|
|
11767
12575
|
<div class="lib-commands" id="cmds-${id}" hidden></div>
|
|
11768
12576
|
</div>`;
|
|
11769
|
-
}).join('') || '<div class="empty-state">No
|
|
12577
|
+
}).join('') || '<div class="empty-state">No tools match.</div>';
|
|
11770
12578
|
$libList.querySelectorAll('[data-expand]').forEach((btn) => {
|
|
11771
12579
|
btn.onclick = () => expandAgent(btn.dataset.expand);
|
|
11772
12580
|
});
|
|
@@ -11891,14 +12699,14 @@
|
|
|
11891
12699
|
if (availableUnsupported) {
|
|
11892
12700
|
$libAvailSearch.hidden = true;
|
|
11893
12701
|
$libAvailList.innerHTML =
|
|
11894
|
-
'<div class="empty-state">Browsing available
|
|
12702
|
+
'<div class="empty-state">Browsing available tools needs AWARE 0.54 or later.' +
|
|
11895
12703
|
'<br><button class="lib-update-link" id="lib-avail-update">Update AWARE →</button></div>';
|
|
11896
12704
|
const up = document.getElementById('lib-avail-update');
|
|
11897
12705
|
if (up) up.onclick = () => {
|
|
11898
12706
|
hideModal($libModal);
|
|
11899
12707
|
const pill = document.getElementById('aware-update');
|
|
11900
12708
|
if (pill && !pill.hidden) pill.click();
|
|
11901
|
-
else showToast('Update AWARE (@aware-aeco/cli) to 0.54+ to browse available
|
|
12709
|
+
else showToast('Update AWARE (@aware-aeco/cli) to 0.54+ to browse available tools', 'info');
|
|
11902
12710
|
};
|
|
11903
12711
|
$libAvailCount.textContent = '';
|
|
11904
12712
|
return;
|
|
@@ -11906,7 +12714,7 @@
|
|
|
11906
12714
|
$libAvailSearch.hidden = false;
|
|
11907
12715
|
|
|
11908
12716
|
if (!availableLoaded) {
|
|
11909
|
-
$libAvailList.innerHTML = '<div class="empty-state"><span class="rtn-spinner"></span> Loading available
|
|
12717
|
+
$libAvailList.innerHTML = '<div class="empty-state"><span class="rtn-spinner"></span> Loading available tools…</div>';
|
|
11910
12718
|
$libAvailCount.textContent = '';
|
|
11911
12719
|
return;
|
|
11912
12720
|
}
|
|
@@ -11921,10 +12729,10 @@
|
|
|
11921
12729
|
|| (a.vendor || '').toLowerCase().includes(q)
|
|
11922
12730
|
|| (a.keywords || []).some((k) => k.toLowerCase().includes(q));
|
|
11923
12731
|
const items = notInstalled.filter(match);
|
|
11924
|
-
$libAvailCount.textContent = `${items.length}
|
|
12732
|
+
$libAvailCount.textContent = `${items.length} tool${items.length === 1 ? '' : 's'}`;
|
|
11925
12733
|
|
|
11926
12734
|
if (!items.length) {
|
|
11927
|
-
$libAvailList.innerHTML = '<div class="empty-state">No
|
|
12735
|
+
$libAvailList.innerHTML = '<div class="empty-state">No tools match.</div>';
|
|
11928
12736
|
return;
|
|
11929
12737
|
}
|
|
11930
12738
|
|
|
@@ -12022,7 +12830,7 @@
|
|
|
12022
12830
|
loadAvailableAgents()
|
|
12023
12831
|
.then(() => { if (onLoaded) onLoaded(); })
|
|
12024
12832
|
.catch((e) => {
|
|
12025
|
-
$libAvailList.innerHTML = '<div class="empty-state">Could not load available
|
|
12833
|
+
$libAvailList.innerHTML = '<div class="empty-state">Could not load available tools.</div>';
|
|
12026
12834
|
$libAvailCount.textContent = '';
|
|
12027
12835
|
reportErr(e);
|
|
12028
12836
|
})
|
|
@@ -12487,6 +13295,31 @@
|
|
|
12487
13295
|
}).observe($integrationsList);
|
|
12488
13296
|
}
|
|
12489
13297
|
|
|
13298
|
+
/**
|
|
13299
|
+
* The xeoRVT card's sentence for its state. On "Needs setup" it is the server's setup remedy when there
|
|
13300
|
+
* is one (#1965 review) — what the person can fix, the same sentence the Workspace card shows — and
|
|
13301
|
+
* otherwise the safe line for the setup category the server named.
|
|
13302
|
+
*/
|
|
13303
|
+
function revitIntegrationDetail(i) {
|
|
13304
|
+
const setupDetails = {
|
|
13305
|
+
'aware-unavailable': 'FloLess couldn’t start the service used by Revit projects.',
|
|
13306
|
+
'core-workflow-provisioning': 'FloLess couldn’t prepare the built-in Workspace workflows.',
|
|
13307
|
+
'reader-verification': 'FloLess couldn’t verify the installed Revit reader.',
|
|
13308
|
+
'workspace-bootstrap': 'FloLess couldn’t prepare the Workspace connection used by Revit workflows.',
|
|
13309
|
+
'revit-workflow-provisioning': 'FloLess couldn’t prepare the Revit project workflows.',
|
|
13310
|
+
'reader-release-unavailable': 'FloLess can’t set up Revit because the required reader version is unavailable. Report this issue, then try setup again after FloLess restores it.',
|
|
13311
|
+
unknown: 'FloLess couldn’t finish Revit setup.',
|
|
13312
|
+
};
|
|
13313
|
+
if (i.status === 'ready') return 'Open your Revit projects and use their model data in FloLess workflows.';
|
|
13314
|
+
if (i.status === 'needs-attention') {
|
|
13315
|
+
const setupRemedy = typeof i.setup?.setupRemedy === 'string' ? i.setup.setupRemedy.trim() : '';
|
|
13316
|
+
return setupRemedy || setupDetails[i.setup && i.setup.category] || setupDetails.unknown;
|
|
13317
|
+
}
|
|
13318
|
+
if (i.status === 'account-selection-required') return 'Choose the FloLess account you want to use before opening Revit projects.';
|
|
13319
|
+
if (i.status === 'check-unavailable') return 'FloLess couldn’t check Revit access. Check your connection and try again.';
|
|
13320
|
+
return 'Revit Parser is not included for this account. Ask the account owner to enable it.';
|
|
13321
|
+
}
|
|
13322
|
+
|
|
12490
13323
|
renderIntegrations = function renderIntegrationsReal() {
|
|
12491
13324
|
if (integrationsLoadState === 'loading' || integrationsLoadState === 'idle') {
|
|
12492
13325
|
$integrationsList.innerHTML = '<div class="empty-state">Checking integrations…</div>';
|
|
@@ -12508,26 +13341,9 @@
|
|
|
12508
13341
|
const needsAccount = i.status === 'account-selection-required';
|
|
12509
13342
|
const checkUnavailable = i.status === 'check-unavailable';
|
|
12510
13343
|
const missingReader = needsAttention && i.setup?.category === 'reader-release-unavailable';
|
|
12511
|
-
const setupDetails = {
|
|
12512
|
-
'aware-unavailable': 'FloLess couldn’t start the service used by Revit projects.',
|
|
12513
|
-
'core-workflow-provisioning': 'FloLess couldn’t prepare the built-in Workspace workflows.',
|
|
12514
|
-
'reader-verification': 'FloLess couldn’t verify the installed Revit reader.',
|
|
12515
|
-
'workspace-bootstrap': 'FloLess couldn’t prepare the Workspace connection used by Revit workflows.',
|
|
12516
|
-
'revit-workflow-provisioning': 'FloLess couldn’t prepare the Revit project workflows.',
|
|
12517
|
-
'reader-release-unavailable': 'FloLess can’t set up Revit because the required reader version is unavailable. Report this issue, then try setup again after FloLess restores it.',
|
|
12518
|
-
unknown: 'FloLess couldn’t finish Revit setup.',
|
|
12519
|
-
};
|
|
12520
13344
|
const badge = ready ? 'Ready' : needsAttention ? 'Needs setup'
|
|
12521
13345
|
: needsAccount ? 'Choose an account' : checkUnavailable ? 'Couldn’t check access' : 'Revit access required';
|
|
12522
|
-
const detail =
|
|
12523
|
-
? 'Open your Revit projects and use their model data in FloLess workflows.'
|
|
12524
|
-
: needsAttention
|
|
12525
|
-
? (setupDetails[i.setup && i.setup.category] || setupDetails.unknown)
|
|
12526
|
-
: needsAccount
|
|
12527
|
-
? 'Choose the FloLess account you want to use before opening Revit projects.'
|
|
12528
|
-
: checkUnavailable
|
|
12529
|
-
? 'FloLess couldn’t check Revit access. Check your connection and try again.'
|
|
12530
|
-
: 'Revit Parser is not included for this account. Ask the account owner to enable it.';
|
|
13346
|
+
const detail = revitIntegrationDetail(i);
|
|
12531
13347
|
const checkLabel = needsAttention ? 'Try setup again' : needsAccount ? 'Choose account'
|
|
12532
13348
|
: ready ? 'Check status' : 'Check access again';
|
|
12533
13349
|
// The Revit detail is always a sentence the person must finish reading (#1524), so it
|
|
@@ -12542,7 +13358,7 @@
|
|
|
12542
13358
|
<span class="int-recovery-actions">
|
|
12543
13359
|
${ready ? '<button class="int-action" data-xeorvt-action="open">Open Revit projects</button>' : ''}
|
|
12544
13360
|
${missingReader ? '<button class="int-action" data-xeorvt-action="report" data-command-id="shell.revit-report-setup-issue" aria-label="Report issue: missing Revit reader" aria-describedby="xeorvt-setup-detail">Report issue</button>' : ''}
|
|
12545
|
-
<button class="int-action" data-xeorvt-action="${needsAccount ? 'account' : 'check'}" data-xeorvt-retry="${needsAttention ? 'true' : 'false'}"${needsAttention ? ' aria-describedby="xeorvt-setup-detail"' : ''}>${checkLabel}</button>
|
|
13361
|
+
<button class="int-action" data-xeorvt-action="${needsAccount ? 'account' : 'check'}" data-xeorvt-retry="${needsAttention ? 'true' : 'false'}"${needsAttention ? ' data-command-id="shell.integrations-revit-retry-setup" aria-describedby="xeorvt-setup-detail"' : ''}>${checkLabel}</button>
|
|
12546
13362
|
</span></div></div></div>`;
|
|
12547
13363
|
}
|
|
12548
13364
|
const action = i.status === 'connected' ? 'Disconnect' : i.status === 'expired' ? 'Reconnect' : 'Connect';
|
|
@@ -12553,7 +13369,7 @@
|
|
|
12553
13369
|
<div class="int-icon" aria-hidden="true">${escapeHtml(VENDOR_ICON[i.vendor] || (i.name[0] || '?'))}</div>
|
|
12554
13370
|
<div class="int-info">
|
|
12555
13371
|
<div class="int-name">${escapeHtml(i.name)}</div>
|
|
12556
|
-
<div class="int-kind">${i.agent === 'first-party' ? 'Built-in integration' : `${escapeHtml(i.vendor || 'integration')} ·
|
|
13372
|
+
<div class="int-kind">${i.agent === 'first-party' ? 'Built-in integration' : `${escapeHtml(i.vendor || 'integration')} · tool <code>${escapeHtml(i.agent)}</code>`}</div>
|
|
12557
13373
|
<div class="int-scopes">${escapeHtml((i.network || []).join(' · ') || '—')}</div>
|
|
12558
13374
|
<div class="int-meta">${escapeHtml(meta)}</div>
|
|
12559
13375
|
${renderIntegrationAccounts(i)}
|
|
@@ -12590,21 +13406,25 @@
|
|
|
12590
13406
|
const hadFocus = document.activeElement === btn;
|
|
12591
13407
|
btn.disabled = true;
|
|
12592
13408
|
btn.textContent = 'Setting up…';
|
|
13409
|
+
// `?` on the busy button says why it cannot be pressed; the next render of the list replaces the button.
|
|
13410
|
+
btn.setAttribute('data-blocked-reason', 'Revit Parser setup retry is already in progress.');
|
|
12593
13411
|
let retryAnnouncement = 'Revit setup is ready.';
|
|
13412
|
+
// What a failed retry says, toasted and announced alike: the server's remedy when there is one
|
|
13413
|
+
// (written for the person, naming their folders, so shown as written), else the safe category line.
|
|
13414
|
+
const failedRetry = (setup) => {
|
|
13415
|
+
const remedy = typeof setup?.setupRemedy === 'string' ? setup.setupRemedy.trim() : '';
|
|
13416
|
+
const message = remedy || (setup?.category === 'reader-release-unavailable'
|
|
13417
|
+
? 'The required Revit reader is unavailable. Choose Report issue; try setup again after FloLess restores it.'
|
|
13418
|
+
: 'Revit setup couldn’t finish. Try setup again.');
|
|
13419
|
+
retryAnnouncement = message;
|
|
13420
|
+
showToast(remedy ? authoredToastCopy(remedy) : message, 'warn');
|
|
13421
|
+
};
|
|
12594
13422
|
try {
|
|
12595
13423
|
const setup = await api('/api/rvt-defaults/retry', { method: 'POST' });
|
|
12596
|
-
if (setup.status !== 'ready')
|
|
12597
|
-
retryAnnouncement = 'Revit setup could not finish. The Integrations card shows what to do next.';
|
|
12598
|
-
showToast(setup.category === 'reader-release-unavailable'
|
|
12599
|
-
? 'The required Revit reader is unavailable. Choose Report issue; try setup again after FloLess restores it.'
|
|
12600
|
-
: 'Revit setup couldn’t finish. Try setup again.', 'warn');
|
|
12601
|
-
}
|
|
13424
|
+
if (setup.status !== 'ready') failedRetry(setup);
|
|
12602
13425
|
}
|
|
12603
13426
|
catch (error) {
|
|
12604
|
-
|
|
12605
|
-
showToast(error?.body?.category === 'reader-release-unavailable'
|
|
12606
|
-
? 'The required Revit reader is unavailable. Choose Report issue; try setup again after FloLess restores it.'
|
|
12607
|
-
: 'Revit setup couldn’t finish. Try setup again.', 'warn');
|
|
13427
|
+
failedRetry(error?.body);
|
|
12608
13428
|
}
|
|
12609
13429
|
await refreshIntegrations();
|
|
12610
13430
|
document.getElementById('integrations-status').textContent = retryAnnouncement;
|
|
@@ -13024,7 +13844,12 @@
|
|
|
13024
13844
|
if (!r.lastRun) return 'Never run yet';
|
|
13025
13845
|
const lr = r.lastRun;
|
|
13026
13846
|
const dur = lr.durationMs != null ? ` · ${(lr.durationMs / 1000).toFixed(1)} s` : '';
|
|
13027
|
-
|
|
13847
|
+
// A run that finished on a stated assumption says so with its outcome, never only in the report.
|
|
13848
|
+
const warnings = Array.isArray(lr.warnings) ? lr.warnings.filter((warning) => typeof warning === 'string' && warning) : [];
|
|
13849
|
+
// #1998: a run made under an approval carried forward to newer tool versions says so, in AWARE's words.
|
|
13850
|
+
const carried = lr.approval && lr.approval.origin === 'successor'
|
|
13851
|
+
? `\nApproval carried over to a newer tool version. AWARE's record: ${lr.approval.label || 'carried forward'}` : '';
|
|
13852
|
+
return `Last run ${lr.status}${lr.reason ? ' — ' + lr.reason : ''}${warnings.length ? ' — ' + warnings.join(' ') : ''} · ${absTime(lr.at)}${dur}${carried}`;
|
|
13028
13853
|
}
|
|
13029
13854
|
|
|
13030
13855
|
// ── Trigger-routine row helpers ─────────────────────────────────────────────
|
|
@@ -13083,6 +13908,10 @@
|
|
|
13083
13908
|
async function loadRoutinesData() {
|
|
13084
13909
|
try {
|
|
13085
13910
|
const res = await api('/api/routines');
|
|
13911
|
+
// The Workflows landing repaints only when the routines its "Scheduled" chips read change, not on every
|
|
13912
|
+
// scheduler tick.
|
|
13913
|
+
const chipKey = (list) => JSON.stringify(list.filter((r) => r.enabled && !r.broken).map((r) => [r.workflow, r.name]));
|
|
13914
|
+
const chipsChanged = chipKey(routinesData) !== chipKey(res.routines || []);
|
|
13086
13915
|
routinesData = res.routines || [];
|
|
13087
13916
|
routinesMax = res.max || 15;
|
|
13088
13917
|
// Reconcile running indicators from the server's authoritative state (queued/
|
|
@@ -13096,7 +13925,11 @@
|
|
|
13096
13925
|
}
|
|
13097
13926
|
for (const id of live) void refreshRoutineReportDiscovery(id);
|
|
13098
13927
|
if ($routinesModal.classList.contains('show')) renderRoutinesList();
|
|
13099
|
-
|
|
13928
|
+
// Last, and on its own: a landing repaint that throws must not skip the reconcile above.
|
|
13929
|
+
if (wfLanding && chipsChanged) {
|
|
13930
|
+
try { renderWorkflowsLanding(); } catch (err) { console.error('Workflows landing repaint failed', err); }
|
|
13931
|
+
}
|
|
13932
|
+
} catch (err) { console.warn('Routines could not be loaded', err); }
|
|
13100
13933
|
}
|
|
13101
13934
|
|
|
13102
13935
|
// SSE: a trigger routine's live session snapshot changed. Update the in-memory
|
|
@@ -13385,7 +14218,11 @@
|
|
|
13385
14218
|
: discovery?.error
|
|
13386
14219
|
? `<div class="rtn-report-note warn" role="status">${escapeHtml(discovery.error)}</div>`
|
|
13387
14220
|
: discovery?.report
|
|
13388
|
-
|
|
14221
|
+
// What the saved report rests on (a scheduled "Latest approved" run that read an older
|
|
14222
|
+
// approved version) is said first, above the report it labels.
|
|
14223
|
+
? (Array.isArray(discovery.report.warnings) ? discovery.report.warnings.filter((warning) => typeof warning === 'string' && warning) : [])
|
|
14224
|
+
.map((warning) => `<div class="rtn-report-note warn" role="status">${escapeHtml(warning)}</div>`).join('')
|
|
14225
|
+
+ `<div class="rtn-report-note">${discovery.earlierReport ? 'Earlier report' : 'Latest report'} · ${escapeHtml(new Date(discovery.report.at).toLocaleString())} · ${Number(discovery.report.summary.objectCount)} objects</div>`
|
|
13389
14226
|
+ (discovery.latestAttempt?.status === 'failed' || discovery.latestAttempt?.status === 'recovery'
|
|
13390
14227
|
? `<div class="rtn-report-note warn" role="status">${discovery.latestAttempt.status === 'recovery' ? 'Recovery needed' : 'Latest attempt failed'} · ${escapeHtml(discovery.latestAttempt.reason || 'Run it again.')}</div>` : '')
|
|
13391
14228
|
: `<div class="rtn-report-note">${discovery?.latestAttempt?.status === 'failed' || discovery?.latestAttempt?.status === 'recovery'
|
|
@@ -13608,10 +14445,11 @@
|
|
|
13608
14445
|
const selection = (extra) => JSON.stringify({ schemaVersion: 'floless.workspace-model-selection/v1', projectUuid: project.projectUuid, ...extra });
|
|
13609
14446
|
const exact = project.versions.slice().sort((a, b) => Number(b.approvalVersion) - Number(a.approvalVersion)).map((version) => ({
|
|
13610
14447
|
value: selection({ approvedRevisionId: version.approvedRevisionId, approvalVersion: version.approvalVersion }),
|
|
13611
|
-
group: project.name, groupMeta: `${name} model`, label: `Approved v${version.approvalVersion}`,
|
|
14448
|
+
group: project.name, groupMeta: `${name} model`, label: `Approved v${version.approvalVersion}${acceptedFindingsMeta(version) ? ` · ${acceptedFindingsMeta(version)}` : ''}`,
|
|
13612
14449
|
meta: version.approvedAt ? new Date(version.approvedAt).toLocaleDateString() : 'Date unavailable',
|
|
13613
14450
|
}));
|
|
13614
|
-
|
|
14451
|
+
const latestAccepted = latestAcceptedFindingsMeta(project.versions);
|
|
14452
|
+
return [...exact, { value: selection({ latestApproved: true }), group: project.name, groupMeta: `${name} model`, label: `Latest approved${latestAccepted ? ` · ${latestAccepted}` : ''}`, meta: 'updates when approvals change' }];
|
|
13615
14453
|
});
|
|
13616
14454
|
const selected = choices.find((choice) => String(choice.value) === String(val));
|
|
13617
14455
|
return `<div class="modal-field"><label>${name} model</label><div class="field-help">Choose the Workspace project and approved revision this scheduled run will read.</div>`
|
|
@@ -13631,8 +14469,10 @@
|
|
|
13631
14469
|
const selection = (extra) => JSON.stringify({ schemaVersion: 'floless.workspace-model-selection/v1', projectUuid: project.projectUuid, ...extra });
|
|
13632
14470
|
return [...project.versions.slice().sort((a, b) => Number(b.approvalVersion) - Number(a.approvalVersion)).map((version) => ({
|
|
13633
14471
|
value: selection({ approvedRevisionId: version.approvedRevisionId, approvalVersion: version.approvalVersion }), group: project.name,
|
|
13634
|
-
groupMeta: `${modelName} model`, label: `Approved v${version.approvalVersion}`,
|
|
13635
|
-
|
|
14472
|
+
groupMeta: `${modelName} model`, label: `Approved v${version.approvalVersion}`,
|
|
14473
|
+
meta: `${version.approvedAt ? new Date(version.approvedAt).toLocaleDateString() : 'Date unavailable'}${acceptedFindingsMeta(version) ? ` · ${acceptedFindingsMeta(version)}` : ''}`,
|
|
14474
|
+
})), { value: selection({ latestApproved: true }), group: project.name, groupMeta: `${modelName} model`, label: 'Latest approved',
|
|
14475
|
+
meta: `updates when approvals change${latestAcceptedFindingsMeta(project.versions) ? ` · ${latestAcceptedFindingsMeta(project.versions)}` : ''}` }];
|
|
13636
14476
|
});
|
|
13637
14477
|
const picked = await formModal({ title: `Choose ${modelName} model`, sub: 'Select a Workspace project and the approved revision this routine will read.', fields: [{
|
|
13638
14478
|
name: 'selection', label: `${modelName} model`, type: 'select', options: choices, value: input.value, required: true,
|
|
@@ -13938,6 +14778,20 @@
|
|
|
13938
14778
|
}
|
|
13939
14779
|
});
|
|
13940
14780
|
|
|
14781
|
+
// #1912: a failed workflow run's "Report this problem" — pre-filled with what failed and the plain
|
|
14782
|
+
// reason the person was shown. Versions and the open workflow ride along as for every report.
|
|
14783
|
+
window.addEventListener('floless:report-run-issue', (event) => {
|
|
14784
|
+
const detail = event.detail || {};
|
|
14785
|
+
openReportIssue();
|
|
14786
|
+
if (detail.returnFocus instanceof HTMLElement) riReturnFocus = detail.returnFocus;
|
|
14787
|
+
const workflow = typeof detail.workflow === 'string' ? detail.workflow : '';
|
|
14788
|
+
$riTitle.value = `Workflow run failed${workflow ? `: ${workflow}` : ''}`.slice(0, 200);
|
|
14789
|
+
const reason = typeof detail.reason === 'string' ? detail.reason.trim().slice(0, 1500) : '';
|
|
14790
|
+
$riDesc.value = `My workflow run failed. FloLess showed: “${typeof detail.message === 'string' ? detail.message : 'the run failed'}”`
|
|
14791
|
+
+ (reason ? `\n\nAWARE's own message:\n${reason}` : '');
|
|
14792
|
+
riSyncSend();
|
|
14793
|
+
});
|
|
14794
|
+
|
|
13941
14795
|
window.addEventListener('floless:report-revit-setup-issue', (event) => {
|
|
13942
14796
|
openReportIssue();
|
|
13943
14797
|
const card = event.detail?.returnFocus;
|
|
@@ -14078,7 +14932,7 @@
|
|
|
14078
14932
|
try {
|
|
14079
14933
|
if (!localStorage.getItem('floless.hint.menuMoved')) {
|
|
14080
14934
|
localStorage.setItem('floless.hint.menuMoved', '1');
|
|
14081
|
-
showToast('
|
|
14935
|
+
showToast('Tools and Routines live in the ≡ menu — press Ctrl+G or Ctrl+R to open them.', 'info');
|
|
14082
14936
|
}
|
|
14083
14937
|
} catch { /* private mode — skip the hint */ }
|
|
14084
14938
|
|
|
@@ -14651,10 +15505,16 @@
|
|
|
14651
15505
|
// #1890: AI Chat is always on. Where no project or owned workflow is open — the Workspaces landing, the Workflows
|
|
14652
15506
|
// landing, an installed (not owned) workflow — the conversation belongs to the workspace, with what is open as context.
|
|
14653
15507
|
function currentChatScope() {
|
|
15508
|
+
// #2007: on the Agents tab AI Chat is the workspace conversation, or the run conversation the person selected.
|
|
15509
|
+
const agentsScope = document.body.classList.contains('mode-agents') ? window.flolessAgents?.chatScope?.() : null;
|
|
15510
|
+
if (agentsScope) return agentsScope;
|
|
14654
15511
|
if (wsTitleName) {
|
|
14655
15512
|
if (wsTitleLanding || !wsTitleProjectId) return { owner: { kind: 'workspace' }, label: 'All projects and workflows' };
|
|
14656
15513
|
return { owner: { kind: 'project', projectId: wsTitleProjectId }, label: wsTitleName };
|
|
14657
15514
|
}
|
|
15515
|
+
if (!wfLanding && draftWorkflow) {
|
|
15516
|
+
return { owner: { kind: 'workflow', workflowId: draftWorkflow.workflowId }, label: draftWorkflow.displayName };
|
|
15517
|
+
}
|
|
14658
15518
|
if (wfLanding || !currentId) return { owner: { kind: 'workspace' }, label: 'All projects and workflows' };
|
|
14659
15519
|
const app = currentId ? apps.get(currentId) : null;
|
|
14660
15520
|
const owned = ownedWorkflowOf(currentId)?.ownedWorkflow;
|
|
@@ -14672,13 +15532,20 @@
|
|
|
14672
15532
|
// The Workflows tab's home, the counterpart of the Workspaces landing: a create card and one card per workflow. It
|
|
14673
15533
|
// renders AWARE's library listing; it composes nothing.
|
|
14674
15534
|
const $wfLanding = document.getElementById('wf-landing');
|
|
15535
|
+
// The landing search's query, kept outside the input because the landing re-renders with innerHTML.
|
|
15536
|
+
let wfLandingQuery = '';
|
|
14675
15537
|
function showWorkflowsLanding(on) {
|
|
14676
15538
|
const next = Boolean(on);
|
|
14677
15539
|
if (next === wfLanding && (!next || $wfLanding?.childElementCount)) { if (next) renderWorkflowsLanding(); return; }
|
|
15540
|
+
if (next && !wfLanding) wfLandingQuery = ''; // a fresh visit starts unfiltered
|
|
14678
15541
|
wfLanding = next;
|
|
15542
|
+
if (wfLanding) closeDraftView();
|
|
14679
15543
|
document.body.classList.toggle('wf-landing-open', wfLanding);
|
|
14680
15544
|
if ($wfLanding) $wfLanding.hidden = !wfLanding;
|
|
14681
|
-
|
|
15545
|
+
// Nothing reads routines at startup (only the Routines window, routine events and a few report paths do), so the
|
|
15546
|
+
// cards' "Scheduled" chips need a read here.
|
|
15547
|
+
if (wfLanding) { hideSpotlight(); renderWorkflowsLanding(); void loadRoutinesData(); }
|
|
15548
|
+
else syncSpotlightToMode(); // the canvas is back: a spotlight held back while the list covered it is offered
|
|
14682
15549
|
syncTabTitle();
|
|
14683
15550
|
notifyChatScope();
|
|
14684
15551
|
}
|
|
@@ -14689,34 +15556,111 @@
|
|
|
14689
15556
|
return `${nodes} node${nodes === 1 ? '' : 's'}${provider ? ` · ${provider}` : ''}`;
|
|
14690
15557
|
}
|
|
14691
15558
|
|
|
15559
|
+
// The card's "Scheduled" chip and its tip ('' = no chip). A routine runs the installed app it names, which is the
|
|
15560
|
+
// card's row id. Only an enabled routine that is not broken counts: a paused one, or one whose workflow can no longer
|
|
15561
|
+
// run (the server gives it no next run), never runs on its own.
|
|
15562
|
+
function scheduledRoutineTip(routines, workflowId) {
|
|
15563
|
+
const names = routines.filter((r) => r.enabled && !r.broken && r.workflow === workflowId).map((r) => `“${r.name}”`);
|
|
15564
|
+
if (!names.length) return '';
|
|
15565
|
+
return names.length === 1 ? `Runs automatically from the routine ${names[0]}.`
|
|
15566
|
+
: `Runs automatically from ${names.length} routines: ${names.join(', ')}.`;
|
|
15567
|
+
}
|
|
15568
|
+
|
|
14692
15569
|
function renderWorkflowsLanding() {
|
|
14693
15570
|
if (!$wfLanding) return;
|
|
14694
15571
|
const focusedId = document.activeElement?.closest?.('#wf-landing [data-wf-id]')?.dataset.wfId || null;
|
|
15572
|
+
const search = document.activeElement?.id === 'wf-landing-search' ? document.activeElement : null;
|
|
15573
|
+
const keepCaret = search ? [search.selectionStart, search.selectionEnd] : null;
|
|
15574
|
+
const clearFocused = document.activeElement?.id === 'wf-search-clear';
|
|
15575
|
+
const focusedDraft = document.activeElement?.closest?.('#wf-landing [data-wf-draft]')?.dataset.wfDraft || null;
|
|
14695
15576
|
const esc = (s) => String(s ?? '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
14696
15577
|
const owned = wfLibrary.filter((row) => row.ownedWorkflow);
|
|
14697
15578
|
const installed = wfLibrary.filter((row) => !row.ownedWorkflow);
|
|
15579
|
+
// #1890 PR 3b-0: owned workflows the library does not list — drafts, and ones whose installed copy is gone.
|
|
15580
|
+
const unlisted = unlistedOwnedWorkflows();
|
|
15581
|
+
const draftCard = (row) => {
|
|
15582
|
+
const recompile = Boolean(row.activePublication);
|
|
15583
|
+
const name = row.displayName;
|
|
15584
|
+
const chip = recompile ? 'Needs compiling' : 'Draft';
|
|
15585
|
+
const meta = `${recompile ? 'Compiled copy missing' : 'Not compiled yet'} · ${row.ownerLabel || 'Standalone'}`;
|
|
15586
|
+
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)}">`
|
|
15587
|
+
+ `<div class="ws-body"><div class="wf-card-text"><span class="ws-kind wf-kind is-draft">${chip}</span>`
|
|
15588
|
+
+ `<div class="ws-name">${esc(name)}</div><div class="ws-meta">${esc(meta)}</div></div></div></div>`;
|
|
15589
|
+
};
|
|
14698
15590
|
const card = (row) => {
|
|
14699
15591
|
const ownedRow = row.ownedWorkflow;
|
|
14700
15592
|
const name = ownedRow ? ownedRow.displayName : (row.displayName || row.name || row.id);
|
|
14701
15593
|
const chip = ownedRow ? 'Yours' : 'Installed';
|
|
14702
15594
|
const where = ownedRow ? (row.ownerLabel || 'Standalone') : (PROVIDER_LABELS[row.provider] || 'Installed workflow');
|
|
15595
|
+
const scheduledTip = scheduledRoutineTip(routinesData, row.id);
|
|
14703
15596
|
return `<div class="ws-card wf-card" role="button" tabindex="0" data-wf-id="${esc(row.id)}" data-command-id="shell.workflows-landing-open#${esc(name)}" data-command-instance-label="${esc(name)}">`
|
|
14704
15597
|
+ `<div class="ws-body"><div class="wf-card-text"><span class="ws-kind wf-kind">${chip}</span>`
|
|
15598
|
+
+ (scheduledTip ? `<span class="ws-kind wf-kind wf-scheduled" data-tip="${esc(scheduledTip)}">Scheduled</span>` : '')
|
|
14705
15599
|
+ `<div class="ws-name">${esc(name)}</div><div class="ws-meta">${esc(where)}</div>`
|
|
14706
15600
|
+ `<div class="ws-meta wf-card-nodes">${esc(workflowCardMeta(row))}</div></div></div></div>`;
|
|
14707
15601
|
};
|
|
14708
15602
|
const group = (title, rows, show) => (rows.length
|
|
14709
15603
|
? `${show ? `<div class="wf-group-label">${esc(title)} (${rows.length})</div>` : ''}<div class="ws-grid">${rows.map(card).join('')}</div>` : '');
|
|
14710
|
-
const
|
|
15604
|
+
const yours = unlisted.length + owned.length;
|
|
15605
|
+
const both = yours > 0 && installed.length > 0;
|
|
15606
|
+
const yoursGroup = yours
|
|
15607
|
+
? `${both ? `<div class="wf-group-label">Your workflows (${yours})</div>` : ''}<div class="ws-grid">${unlisted.map(draftCard).join('')}${owned.map(card).join('')}</div>`
|
|
15608
|
+
: '';
|
|
14711
15609
|
$wfLanding.innerHTML = `<div class="ws-head"><div class="ws-head-text"><h2 tabindex="-1" id="wf-landing-title">Workflows</h2>`
|
|
14712
|
-
+ `<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></div
|
|
15610
|
+
+ `<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></div>`
|
|
15611
|
+
+ (wfLibrary.length || unlisted.length ? `<div class="ws-head-actions"><input type="search" id="wf-landing-search" class="ws-landing-search" data-command-id="shell.workflows-landing-search" placeholder="Search workflows" aria-label="Search workflows by name, project or tool" autocomplete="off" spellcheck="false" value="${esc(wfLandingQuery)}"></div>` : '')
|
|
15612
|
+
+ `</div>`
|
|
14713
15613
|
+ `<div class="ws-create-grid"><div class="ws-card ws-create wf-create" role="button" tabindex="0" data-wf-new="1" data-command-id="shell.workflows-landing-new">`
|
|
14714
15614
|
+ `<div class="ws-thumb">+</div><div class="ws-body"><div><div class="ws-name">New workflow</div>`
|
|
14715
15615
|
+ `<div class="ws-meta">Name it and choose where it belongs. AI builds it with you.</div></div></div></div></div>`
|
|
14716
|
-
+ (wfLibrary.length
|
|
14717
|
-
?
|
|
15616
|
+
+ (wfLibrary.length || unlisted.length
|
|
15617
|
+
? yoursGroup + group('Installed', installed, both)
|
|
15618
|
+
+ '<div class="ws-empty-note ws-search-empty" id="wf-search-empty" role="status" aria-live="polite"></div>'
|
|
14718
15619
|
: '<div class="ws-empty-note">No workflows yet. Start with New workflow, or ask AI Chat on the left.</div>');
|
|
14719
15620
|
if (focusedId) $wfLanding.querySelector(`[data-wf-id="${CSS.escape(focusedId)}"]`)?.focus();
|
|
15621
|
+
if (focusedDraft) $wfLanding.querySelector(`[data-wf-draft="${CSS.escape(focusedDraft)}"]`)?.focus();
|
|
15622
|
+
if (keepCaret) $wfLanding.querySelector('#wf-landing-search')?.focus();
|
|
15623
|
+
applyWorkflowsLandingSearch(keepCaret);
|
|
15624
|
+
if (clearFocused) $wfLanding.querySelector('#wf-search-clear')?.focus(); // it only exists once the filter ran
|
|
15625
|
+
}
|
|
15626
|
+
|
|
15627
|
+
/** Hide the workflow cards that don't match the landing search: every typed word must appear somewhere in the
|
|
15628
|
+
* card's name or the line under it (its project, or the tool an installed workflow runs on), never in its
|
|
15629
|
+
* "N nodes · tool" line, which every card has. New workflow is an action,
|
|
15630
|
+
* not a result, so it stays. A group with nothing left hides its label; a shown label counts "1 of 3". */
|
|
15631
|
+
function applyWorkflowsLandingSearch(caret) {
|
|
15632
|
+
const input = $wfLanding.querySelector('#wf-landing-search');
|
|
15633
|
+
if (!input) return;
|
|
15634
|
+
const terms = wfLandingQuery.trim().toLowerCase().split(/\s+/).filter(Boolean);
|
|
15635
|
+
let shownAll = 0;
|
|
15636
|
+
for (const grid of $wfLanding.querySelectorAll('.ws-grid')) {
|
|
15637
|
+
const cards = grid.querySelectorAll('.wf-card[data-wf-id], .wf-card[data-wf-draft]');
|
|
15638
|
+
let shown = 0;
|
|
15639
|
+
for (const card of cards) {
|
|
15640
|
+
const hay = Array.from(card.querySelectorAll('.ws-name, .ws-meta:not(.wf-card-nodes)'), (el) => el.textContent).join(' ').toLowerCase();
|
|
15641
|
+
card.hidden = !terms.every((t) => hay.includes(t));
|
|
15642
|
+
if (!card.hidden) shown++;
|
|
15643
|
+
}
|
|
15644
|
+
grid.hidden = !shown;
|
|
15645
|
+
const label = grid.previousElementSibling?.classList.contains('wf-group-label') ? grid.previousElementSibling : null;
|
|
15646
|
+
if (label) {
|
|
15647
|
+
label.hidden = !shown;
|
|
15648
|
+
label.textContent = label.textContent.replace(/\(\d+(?: of \d+)?\)$/, terms.length ? `(${shown} of ${cards.length})` : `(${cards.length})`);
|
|
15649
|
+
}
|
|
15650
|
+
shownAll += shown;
|
|
15651
|
+
}
|
|
15652
|
+
const note = $wfLanding.querySelector('#wf-search-empty');
|
|
15653
|
+
if (note) {
|
|
15654
|
+
note.textContent = shownAll ? '' : `No workflows match “${wfLandingQuery.trim()}”. `; // text, never markup: it echoes what was typed
|
|
15655
|
+
if (!shownAll) note.insertAdjacentHTML('beforeend', '<button type="button" id="wf-search-clear" data-command-id="shell.workflows-landing-search-clear">Clear search</button>');
|
|
15656
|
+
}
|
|
15657
|
+
if (caret) input.setSelectionRange(caret[0], caret[1]);
|
|
15658
|
+
}
|
|
15659
|
+
function setWorkflowsLandingQuery(q) {
|
|
15660
|
+
wfLandingQuery = q;
|
|
15661
|
+
const input = $wfLanding.querySelector('#wf-landing-search');
|
|
15662
|
+
if (input) input.value = q;
|
|
15663
|
+
applyWorkflowsLandingSearch();
|
|
14720
15664
|
}
|
|
14721
15665
|
|
|
14722
15666
|
// One card opens at a time: loadApp has no ordering of its own, so a second quick click could land first and then
|
|
@@ -14730,15 +15674,239 @@
|
|
|
14730
15674
|
loadApp(id).then(() => showWorkflowsLanding(false)).catch(reportErr).finally(() => { landingOpening = false; });
|
|
14731
15675
|
}
|
|
14732
15676
|
|
|
15677
|
+
// ── Draft workflows (#1890 PR 3b-0) ──────────────────────────────────────────────
|
|
15678
|
+
// A workflow that has no installed copy yet — just created by AI Chat or New workflow, or one whose installed copy
|
|
15679
|
+
// is gone — opens here: what it is, where it lives, and Compile when it has a workflow file. Its AI Chat is the
|
|
15680
|
+
// workflow's own. It renders the owned-workflow record; compiling is the existing publish verb, pressed by a person.
|
|
15681
|
+
const $wfDraft = document.getElementById('wf-draft');
|
|
15682
|
+
|
|
15683
|
+
/** Owned workflows the published library does not list: drafts, and ones whose installed copy is missing. */
|
|
15684
|
+
function unlistedOwnedWorkflows() {
|
|
15685
|
+
const listed = new Set(wfLibrary.map((row) => row.ownedWorkflow?.workflowId).filter(Boolean));
|
|
15686
|
+
const rows = wfOwned.filter((row) => row.status !== 'archived' && !listed.has(row.workflowId));
|
|
15687
|
+
// Drafts first (the newest are what someone just made), then the ones needing compiling again.
|
|
15688
|
+
return rows.sort((a, b) => (Boolean(a.activePublication) - Boolean(b.activePublication))
|
|
15689
|
+
|| String(b.updatedAt || '').localeCompare(String(a.updatedAt || '')));
|
|
15690
|
+
}
|
|
15691
|
+
|
|
15692
|
+
function openDraftWorkflow(workflowId) {
|
|
15693
|
+
const row = wfOwned.find((item) => item.workflowId === workflowId && item.status !== 'archived');
|
|
15694
|
+
if (!row || !$wfDraft) return;
|
|
15695
|
+
selectionTicket += 1;
|
|
15696
|
+
if (draftWorkflow) closeDraftView();
|
|
15697
|
+
draftWorkflow = { workflowId: row.workflowId, displayName: row.displayName, ownerLabel: row.ownerLabel || 'Standalone',
|
|
15698
|
+
hasSource: Boolean(row.hasSource), recompile: Boolean(row.activePublication), compiling: false, busy: false,
|
|
15699
|
+
failed: false, note: null, watch: new AbortController() };
|
|
15700
|
+
currentId = null;
|
|
15701
|
+
workflowSelectionGeneration += 1;
|
|
15702
|
+
if (wfLanding) {
|
|
15703
|
+
wfLanding = false;
|
|
15704
|
+
document.body.classList.remove('wf-landing-open');
|
|
15705
|
+
if ($wfLanding) $wfLanding.hidden = true;
|
|
15706
|
+
}
|
|
15707
|
+
document.body.classList.add('wf-draft-open');
|
|
15708
|
+
$wfDraft.hidden = false;
|
|
15709
|
+
hideSpotlight();
|
|
15710
|
+
paintBeacon(null);
|
|
15711
|
+
renderDraftView();
|
|
15712
|
+
paintDraftChrome();
|
|
15713
|
+
syncTabTitle();
|
|
15714
|
+
notifyChatScope();
|
|
15715
|
+
void watchDraft(draftWorkflow);
|
|
15716
|
+
document.getElementById('wf-draft-title')?.focus();
|
|
15717
|
+
}
|
|
15718
|
+
|
|
15719
|
+
// The AI writes a draft's workflow file from its chat, which raises no workflow event, so an open draft re-reads
|
|
15720
|
+
// its own record every few seconds — that is what reveals Compile once the file exists (#1890 PR 3b-0, rebuilt at the
|
|
15721
|
+
// review stop signal, Fable + Codex). One loop per open draft: the next read starts only after the previous read and
|
|
15722
|
+
// any refresh it started have finished, so this loop never overlaps itself; it pauses while Compile and its own
|
|
15723
|
+
// refresh run (`busy`), and closing the draft ends it and aborts its pending read. Overlap with refreshes started
|
|
15724
|
+
// elsewhere (apps-changed, Compile) is the loadApps generation guard's job, not this loop's.
|
|
15725
|
+
const DRAFT_WATCH_MS = 4000;
|
|
15726
|
+
const sleep = (ms) => new Promise((resolve) => { setTimeout(resolve, ms); });
|
|
15727
|
+
|
|
15728
|
+
async function watchDraft(d) {
|
|
15729
|
+
while (draftWorkflow === d) {
|
|
15730
|
+
await sleep(DRAFT_WATCH_MS);
|
|
15731
|
+
if (draftWorkflow !== d) return;
|
|
15732
|
+
if (d.busy) continue;
|
|
15733
|
+
await readDraftOnce(d);
|
|
15734
|
+
}
|
|
15735
|
+
}
|
|
15736
|
+
|
|
15737
|
+
async function readDraftOnce(d) {
|
|
15738
|
+
let workflow;
|
|
15739
|
+
try {
|
|
15740
|
+
({ workflow } = await api(`/api/workflows/owned/${encodeURIComponent(d.workflowId)}`, { signal: d.watch.signal }));
|
|
15741
|
+
} catch { return; /* aborted on close, or a missed read: the next turn of the loop tries again */ }
|
|
15742
|
+
if (draftWorkflow !== d || d.busy) return;
|
|
15743
|
+
if (workflow.status === 'archived' || (workflow.activePublication?.runtimeAppId && !d.recompile)) {
|
|
15744
|
+
// Its own publication or archive: the refresh decides (resolveOpenDraft), inside this turn of the loop.
|
|
15745
|
+
try { await loadApps(); } catch (error) { if (draftWorkflow === d) reportErr(error); }
|
|
15746
|
+
return;
|
|
15747
|
+
}
|
|
15748
|
+
if (Boolean(workflow.hasSource) !== d.hasSource || workflow.displayName !== d.displayName) {
|
|
15749
|
+
d.hasSource = Boolean(workflow.hasSource);
|
|
15750
|
+
d.displayName = workflow.displayName;
|
|
15751
|
+
renderDraftView();
|
|
15752
|
+
paintDraftChrome();
|
|
15753
|
+
}
|
|
15754
|
+
}
|
|
15755
|
+
|
|
15756
|
+
function closeDraftView() {
|
|
15757
|
+
if (!draftWorkflow) return;
|
|
15758
|
+
draftWorkflow.watch.abort();
|
|
15759
|
+
draftWorkflow = null;
|
|
15760
|
+
document.body.classList.remove('wf-draft-open');
|
|
15761
|
+
if ($wfDraft) { $wfDraft.hidden = true; $wfDraft.innerHTML = ''; }
|
|
15762
|
+
}
|
|
15763
|
+
|
|
15764
|
+
/** The header picker, the tab title and the Instructor band name the draft, not the workflow open before it. */
|
|
15765
|
+
function paintDraftChrome() {
|
|
15766
|
+
const d = draftWorkflow;
|
|
15767
|
+
if (!d) return;
|
|
15768
|
+
setComboTriggerLabel(d.displayName);
|
|
15769
|
+
setComboSelected(null);
|
|
15770
|
+
window.Instructor?.setWorkflow({ name: d.displayName, runState: 'draft', statusLabel: 'Draft', hasSource: d.hasSource,
|
|
15771
|
+
totalInputs: 0, inputsSet: 0 });
|
|
15772
|
+
}
|
|
15773
|
+
|
|
15774
|
+
function renderDraftView() {
|
|
15775
|
+
if (!$wfDraft || !draftWorkflow) return;
|
|
15776
|
+
const d = draftWorkflow;
|
|
15777
|
+
const esc = (s) => String(s ?? '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
15778
|
+
const where = d.ownerLabel === 'Standalone' ? 'Standalone' : `In ${d.ownerLabel}`;
|
|
15779
|
+
const state = d.recompile ? 'Needs compiling again' : 'Draft';
|
|
15780
|
+
let body;
|
|
15781
|
+
let action = '';
|
|
15782
|
+
if (!d.hasSource) {
|
|
15783
|
+
body = d.recompile
|
|
15784
|
+
? 'This workflow’s file is missing. Ask the AI in this chat to write it again.'
|
|
15785
|
+
: 'This workflow has no workflow file yet. Ask the AI in this chat to write it.';
|
|
15786
|
+
} else {
|
|
15787
|
+
body = d.recompile
|
|
15788
|
+
? 'The compiled copy of this workflow is missing or no longer matches. Compile it again to run it.'
|
|
15789
|
+
: 'Not compiled yet. Compile it to run it.';
|
|
15790
|
+
const busy = d.compiling ? ' aria-disabled="true"' : '';
|
|
15791
|
+
action = d.recompile
|
|
15792
|
+
? `<button type="button" class="primary" id="wf-draft-compile" data-command-id="shell.workflow-draft-compile-again"${busy}>${d.compiling ? 'Compiling…' : 'Compile again'}</button>`
|
|
15793
|
+
: `<button type="button" class="primary" id="wf-draft-compile" data-command-id="shell.workflow-draft-compile"${busy}>${d.compiling ? 'Compiling…' : 'Compile'}</button>`;
|
|
15794
|
+
}
|
|
15795
|
+
const failure = d.failed
|
|
15796
|
+
? `<div class="wf-draft-failure" role="alert" tabindex="-1" id="wf-draft-failure">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 try again.`
|
|
15797
|
+
+ `<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>`
|
|
15798
|
+
+ `<button type="button" id="wf-draft-retry" data-command-id="shell.workflow-draft-retry">Try again</button></div></div>`
|
|
15799
|
+
: '';
|
|
15800
|
+
$wfDraft.innerHTML = `<div class="wf-draft-panel">`
|
|
15801
|
+
+ `<h2 class="wf-draft-title" id="wf-draft-title" tabindex="-1">${esc(d.displayName)}</h2>`
|
|
15802
|
+
+ `<div class="wf-draft-where">${esc(where)} · <span class="ws-kind wf-kind is-draft">${state}</span></div>`
|
|
15803
|
+
+ `<p class="wf-draft-body">${esc(body)}</p>`
|
|
15804
|
+
+ (failure || (action ? `<div class="wf-draft-actions">${action}</div>` : ''))
|
|
15805
|
+
+ (d.note ? `<p class="wf-draft-body" role="status">${esc(d.note)}</p>` : '')
|
|
15806
|
+
// #1949: the same Archive the published workflow has in the picker — same command, same confirm — so a draft
|
|
15807
|
+
// someone no longer wants can leave the Workflows page from its own view. Quiet (not primary): it is the exit,
|
|
15808
|
+
// not the next step.
|
|
15809
|
+
+ `<div class="wf-draft-actions wf-draft-exit"><button type="button" class="wf-draft-archive" id="wf-draft-archive" data-command-id="workflow.archive#${esc(d.workflowId)}" data-command-instance-label="${esc(d.displayName)}" data-tip="Hide this workflow from the Workflows page. Its files stay on this computer.">Archive</button></div>`
|
|
15810
|
+
+ `<div class="sr-only" role="status" aria-live="polite" id="wf-draft-status">${d.compiling ? 'Compiling…' : ''}</div>`
|
|
15811
|
+
+ `</div>`;
|
|
15812
|
+
}
|
|
15813
|
+
|
|
15814
|
+
async function compileDraftWorkflow() {
|
|
15815
|
+
const d = draftWorkflow;
|
|
15816
|
+
if (!d || d.compiling || !d.hasSource) return;
|
|
15817
|
+
d.busy = true; // the watch loop stays out until Compile and its own refresh have finished
|
|
15818
|
+
d.compiling = true;
|
|
15819
|
+
d.failed = false;
|
|
15820
|
+
d.note = null;
|
|
15821
|
+
renderDraftView();
|
|
15822
|
+
document.getElementById('wf-draft-compile')?.focus();
|
|
15823
|
+
try {
|
|
15824
|
+
await api(`/api/workflows/owned/${encodeURIComponent(d.workflowId)}/publish`, { method: 'POST' });
|
|
15825
|
+
} catch {
|
|
15826
|
+
// The route's own wording is internal; the person gets the plain sentence and two ways on.
|
|
15827
|
+
d.busy = false;
|
|
15828
|
+
if (draftWorkflow !== d) return;
|
|
15829
|
+
d.compiling = false;
|
|
15830
|
+
d.failed = true;
|
|
15831
|
+
renderDraftView();
|
|
15832
|
+
document.getElementById('wf-draft-failure')?.focus();
|
|
15833
|
+
return;
|
|
15834
|
+
}
|
|
15835
|
+
// Compiled. The refresh finds this draft's own publication and opens it, keeping its chat (resolveOpenDraft).
|
|
15836
|
+
d.compiling = false;
|
|
15837
|
+
try {
|
|
15838
|
+
await loadApps();
|
|
15839
|
+
} catch (error) {
|
|
15840
|
+
reportErr(error);
|
|
15841
|
+
} finally {
|
|
15842
|
+
d.busy = false;
|
|
15843
|
+
}
|
|
15844
|
+
if (draftWorkflow === d) {
|
|
15845
|
+
// Still here: compiled, but not opened yet — say so truthfully, never "couldn't compile".
|
|
15846
|
+
d.note = `${d.displayName} is compiled. FloLess couldn’t open it yet — open it from the Workflows page.`;
|
|
15847
|
+
renderDraftView();
|
|
15848
|
+
}
|
|
15849
|
+
}
|
|
15850
|
+
|
|
15851
|
+
/**
|
|
15852
|
+
* After a refresh, the open draft's own fate only (#1890 PR 3b-0): published now → open the published workflow,
|
|
15853
|
+
* its chat staying; archived or gone → back to the landing, saying so; otherwise it stays, its file state refreshed.
|
|
15854
|
+
*/
|
|
15855
|
+
async function resolveOpenDraft() {
|
|
15856
|
+
const d = draftWorkflow;
|
|
15857
|
+
if (!d) return;
|
|
15858
|
+
const published = wfLibrary.find((row) => row.ownedWorkflow?.workflowId === d.workflowId);
|
|
15859
|
+
if (published) { await loadApp(published.id); return; }
|
|
15860
|
+
const row = wfOwned.find((item) => item.workflowId === d.workflowId);
|
|
15861
|
+
if (!row || row.status === 'archived') {
|
|
15862
|
+
const name = d.displayName;
|
|
15863
|
+
closeDraftView();
|
|
15864
|
+
showWorkflowsLanding(true);
|
|
15865
|
+
document.getElementById('wf-landing-title')?.focus();
|
|
15866
|
+
showToast(`${name} was archived or removed.`, 'info');
|
|
15867
|
+
return;
|
|
15868
|
+
}
|
|
15869
|
+
d.hasSource = Boolean(row.hasSource);
|
|
15870
|
+
d.recompile = Boolean(row.activePublication);
|
|
15871
|
+
d.displayName = row.displayName;
|
|
15872
|
+
d.ownerLabel = row.ownerLabel || d.ownerLabel;
|
|
15873
|
+
if (!d.compiling) renderDraftView();
|
|
15874
|
+
paintDraftChrome();
|
|
15875
|
+
}
|
|
15876
|
+
|
|
15877
|
+
if ($wfDraft) {
|
|
15878
|
+
$wfDraft.addEventListener('click', (event) => {
|
|
15879
|
+
if (event.target.closest('#wf-draft-compile, #wf-draft-retry')) { void compileDraftWorkflow(); return; }
|
|
15880
|
+
if (event.target.closest('#wf-draft-archive') && draftWorkflow) { void archiveOwnedWorkflow(draftWorkflow.workflowId, draftWorkflow.displayName); return; }
|
|
15881
|
+
if (event.target.closest('#wf-draft-ask') && draftWorkflow) {
|
|
15882
|
+
const name = draftWorkflow.displayName;
|
|
15883
|
+
void window.flolessChat?.openDraft?.(`FloLess couldn't compile the workflow "${name}". Please check its workflow file and fix what stops it compiling.`)?.catch(reportErr);
|
|
15884
|
+
}
|
|
15885
|
+
});
|
|
15886
|
+
}
|
|
15887
|
+
|
|
14733
15888
|
if ($wfLanding) {
|
|
14734
15889
|
$wfLanding.addEventListener('click', (event) => {
|
|
14735
15890
|
if (event.target.closest('[data-wf-new]')) { requestNewWorkflow(); return; }
|
|
15891
|
+
// Clearing empties the message the button sits in, so focus goes back to the search box.
|
|
15892
|
+
if (event.target.closest('#wf-search-clear')) { setWorkflowsLandingQuery(''); $wfLanding.querySelector('#wf-landing-search')?.focus(); return; }
|
|
15893
|
+
const draftEl = event.target.closest('[data-wf-draft]');
|
|
15894
|
+
if (draftEl) { if (!landingOpening) openDraftWorkflow(draftEl.dataset.wfDraft); return; }
|
|
14736
15895
|
const cardEl = event.target.closest('[data-wf-id]');
|
|
14737
15896
|
if (cardEl) openWorkflowFromLanding(cardEl.dataset.wfId);
|
|
14738
15897
|
});
|
|
15898
|
+
$wfLanding.addEventListener('input', (event) => {
|
|
15899
|
+
if (event.target.id !== 'wf-landing-search') return;
|
|
15900
|
+
wfLandingQuery = event.target.value;
|
|
15901
|
+
applyWorkflowsLandingSearch();
|
|
15902
|
+
});
|
|
14739
15903
|
$wfLanding.addEventListener('keydown', (event) => {
|
|
15904
|
+
// Esc clears a search that has text; an empty box lets Esc through to whatever else listens for it.
|
|
15905
|
+
if (event.key === 'Escape' && event.target.id === 'wf-landing-search' && event.target.value) {
|
|
15906
|
+
event.preventDefault(); event.stopPropagation(); setWorkflowsLandingQuery(''); return;
|
|
15907
|
+
}
|
|
14740
15908
|
if (event.key !== 'Enter' && event.key !== ' ') return;
|
|
14741
|
-
const target = event.target.closest('[data-wf-id], [data-wf-new]');
|
|
15909
|
+
const target = event.target.closest('[data-wf-id], [data-wf-new], [data-wf-draft]');
|
|
14742
15910
|
if (!target || target !== event.target) return;
|
|
14743
15911
|
event.preventDefault();
|
|
14744
15912
|
target.click();
|
|
@@ -14772,6 +15940,37 @@
|
|
|
14772
15940
|
return openRequests(requestId || null);
|
|
14773
15941
|
},
|
|
14774
15942
|
preferredChatProvider,
|
|
15943
|
+
// #1997: open an installed workflow by its AWARE app id (the "Open workflow" next step of Approve updated
|
|
15944
|
+
// workflows, e.g. "open it and press Compile").
|
|
15945
|
+
// Only a workflow the Workflows page lists can be opened; one installed outside FloLess (from a terminal) is not.
|
|
15946
|
+
canOpenApp: (appId) => wfLibrary.some((row) => row.id === appId),
|
|
15947
|
+
async openApp(appId) {
|
|
15948
|
+
await window.flolessWorkspaces?.setMode?.('workflows');
|
|
15949
|
+
await loadApps();
|
|
15950
|
+
if (!wfLibrary.some((row) => row.id === appId)) {
|
|
15951
|
+
throw new Error('That workflow is not on your Workflows page, so FloLess cannot open it. Compile it from the terminal that installed it.');
|
|
15952
|
+
}
|
|
15953
|
+
await loadApp(appId);
|
|
15954
|
+
showWorkflowsLanding(false);
|
|
15955
|
+
return true;
|
|
15956
|
+
},
|
|
15957
|
+
// #1890 PR 3b: open a FloLess-owned workflow by its id — its published app when it has one, otherwise its draft
|
|
15958
|
+
// view — so a conversation that moved into it can be followed there. Throws a plain sentence when it is gone.
|
|
15959
|
+
async openOwnedWorkflow(workflowId) {
|
|
15960
|
+
await window.flolessWorkspaces?.setMode?.('workflows');
|
|
15961
|
+
await loadApps();
|
|
15962
|
+
const published = wfLibrary.find((row) => row.ownedWorkflow?.workflowId === workflowId);
|
|
15963
|
+
if (published) {
|
|
15964
|
+
await loadApp(published.id);
|
|
15965
|
+
showWorkflowsLanding(false);
|
|
15966
|
+
return true;
|
|
15967
|
+
}
|
|
15968
|
+
if (wfOwned.some((row) => row.workflowId === workflowId && row.status !== 'archived')) {
|
|
15969
|
+
openDraftWorkflow(workflowId);
|
|
15970
|
+
return true;
|
|
15971
|
+
}
|
|
15972
|
+
throw new Error('That workflow is no longer here, so its conversation can’t be opened.');
|
|
15973
|
+
},
|
|
14775
15974
|
// The New project dialog's AI choice (#1605): the installed Claude/Codex rows as last read, and
|
|
14776
15975
|
// a fresh read of them. The same shared runtime state preferredChatProvider() answers from, so
|
|
14777
15976
|
// the dialog's default and its options can never disagree.
|
|
@@ -14872,14 +16071,15 @@
|
|
|
14872
16071
|
// Tab title: workspaces.js owns which project is open, aware.js owns document.title (one
|
|
14873
16072
|
// writer — the workflow combo keeps updating underneath in Workspaces mode). Pass the open
|
|
14874
16073
|
// project's name, 'Workspaces' on the landing, or null to hand the tab back to the workflow.
|
|
14875
|
-
setWorkspaceTitle(name, landing = false, projectId = null) {
|
|
16074
|
+
setWorkspaceTitle(name, landing = false, projectId = null, kind = null) {
|
|
14876
16075
|
wsTitleName = name || null;
|
|
16076
|
+
wsTitleKind = wsTitleName && kind === 'agents' ? 'agents' : null;
|
|
14877
16077
|
wsTitleLanding = !!(wsTitleName && landing);
|
|
14878
16078
|
wsTitleProjectId = wsTitleName && !wsTitleLanding ? projectId || null : null;
|
|
14879
16079
|
syncTabTitle();
|
|
14880
16080
|
if (window.Instructor && typeof window.Instructor.setWorkspace === 'function') {
|
|
14881
16081
|
window.Instructor.setWorkspace(wsTitleName
|
|
14882
|
-
? { name: wsTitleName, landing: wsTitleLanding, projectId: wsTitleProjectId }
|
|
16082
|
+
? { name: wsTitleName, landing: wsTitleLanding, projectId: wsTitleProjectId, ...(wsTitleKind ? { kind: wsTitleKind } : {}) }
|
|
14883
16083
|
: null);
|
|
14884
16084
|
}
|
|
14885
16085
|
notifyChatScope();
|
|
@@ -14888,13 +16088,18 @@
|
|
|
14888
16088
|
// Instructor mounts, so expose the last visible title for a one-time initialization replay.
|
|
14889
16089
|
getWorkspaceContext() {
|
|
14890
16090
|
return wsTitleName
|
|
14891
|
-
? { name: wsTitleName, landing: wsTitleLanding, projectId: wsTitleProjectId }
|
|
16091
|
+
? { name: wsTitleName, landing: wsTitleLanding, projectId: wsTitleProjectId, ...(wsTitleKind ? { kind: wsTitleKind } : {}) }
|
|
14892
16092
|
: null;
|
|
14893
16093
|
},
|
|
14894
16094
|
getChatScope() {
|
|
14895
16095
|
return currentChatScope();
|
|
14896
16096
|
},
|
|
16097
|
+
// #2007: the workflow spotlight follows the tab switch (see syncSpotlightToMode).
|
|
16098
|
+
syncGuideSpotlight: () => syncSpotlightToMode(),
|
|
14897
16099
|
// #1890: the active Workflows tab is the way home to the Workflows landing (as Workspaces' is to its own).
|
|
16100
|
+
// workspaces.js calls this when the user switches back into Workflows: the landing stays mounted behind
|
|
16101
|
+
// Workspaces, so showWorkflowsLanding's own fresh-visit reset never runs on that path.
|
|
16102
|
+
resetWorkflowsLandingSearch() { if ($wfLanding) setWorkflowsLandingQuery(''); },
|
|
14898
16103
|
showWorkflowsLanding() {
|
|
14899
16104
|
showWorkflowsLanding(true);
|
|
14900
16105
|
document.getElementById('wf-landing-title')?.focus();
|