@floless/app 0.148.0 → 0.149.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/bin/floless.mjs +1 -1
- package/dist/floless-server.cjs +29419 -19062
- package/dist/schemas/drawing-check.profile.v1.schema.json +156 -0
- package/dist/schemas/steel.model.v2.schema.json +43 -1
- package/dist/schemas/tekla.model.v2.schema.json +6 -2
- package/dist/skills/floless-app-steel-model/SKILL.md +54 -11
- package/dist/skills/floless-app-steel-model/references/detail-from-a-screenshot.md +9 -5
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +128 -15
- package/dist/skills/floless-app-vectorize/SKILL.md +7 -4
- package/dist/templates/check-drawings.flo +46 -0
- package/dist/templates/drawing-check.flo +55 -0
- package/dist/templates/tekla-parser.flo +6 -2
- package/dist/web/app.css +143 -8
- package/dist/web/aware.js +512 -42
- package/dist/web/chat.css +171 -9
- package/dist/web/chat.js +2005 -759
- package/dist/web/commands-drawing-check.js +53 -0
- package/dist/web/commands-shell.js +275 -3
- package/dist/web/commands-steel.js +1 -0
- package/dist/web/commands-tekla-parser.js +3 -0
- package/dist/web/commands.js +1 -1
- package/dist/web/connections.js +382 -0
- package/dist/web/display-units.js +15 -1
- package/dist/web/drawing-check-editor.html +289 -0
- package/dist/web/drawing-check-editor.js +1242 -0
- package/dist/web/drawing-check-overlay.js +36 -0
- package/dist/web/filter-ai-proposal.js +32 -13
- package/dist/web/index.html +25 -3
- package/dist/web/instructor.js +2 -2
- package/dist/web/local-discovery.js +144 -2
- package/dist/web/model-display-units.js +23 -9
- package/dist/web/model-viewport-revit-adapter.js +12 -2
- package/dist/web/revit-editor.css +5 -0
- package/dist/web/revit-editor.js +141 -21
- package/dist/web/steel-editor.html +166 -27
- package/dist/web/steel-filter.html +60 -166
- package/dist/web/steel-model-v2-commands.js +13 -3
- package/dist/web/steel-model-v2-projection.js +20 -0
- package/dist/web/steel-units.js +3 -1
- package/dist/web/workspaces.js +323 -26
- package/distribution-resource-inventory.mjs +8 -1
- package/launch.mjs +5 -5
- package/package.json +3 -1
- package/dist/web/filter-ai-context.js +0 -92
package/dist/web/aware.js
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
const $runState = document.getElementById('run-state');
|
|
18
18
|
const $notesStrip = document.getElementById('notes-strip');
|
|
19
19
|
const $kbInformed = document.getElementById('kb-informed');
|
|
20
|
+
const $workflowUnits = document.getElementById('workflow-units');
|
|
20
21
|
const $kbInformedPages = document.getElementById('kb-informed-pages');
|
|
21
22
|
const $kbDriftChip = document.getElementById('kb-drift-chip');
|
|
22
23
|
const $reportModal = document.getElementById('report-modal');
|
|
@@ -62,6 +63,17 @@
|
|
|
62
63
|
const liveTrace = [];
|
|
63
64
|
// Latest normalized app payload, keyed by id, so handlers can read mode/gate.
|
|
64
65
|
const apps = new Map();
|
|
66
|
+
// Who owns each listed workflow, from the Workflows library (/api/workflows/library). A PARALLEL map like
|
|
67
|
+
// contractStates: `apps` holds AWARE's app spec from /api/app/:id, which never carries FloLess's owner record,
|
|
68
|
+
// so reading `apps.get(id).ownedWorkflow` found nothing and a workflow's AI Chat scope and Units never resolved.
|
|
69
|
+
const workflowOwners = new Map();
|
|
70
|
+
function ownedWorkflowOf(id) { return (id && workflowOwners.get(id)) || null; }
|
|
71
|
+
function rememberWorkflowOwners(list) {
|
|
72
|
+
workflowOwners.clear();
|
|
73
|
+
for (const row of list) {
|
|
74
|
+
if (row.ownedWorkflow?.workflowId) workflowOwners.set(row.id, { ownedWorkflow: row.ownedWorkflow, ownerLabel: row.ownerLabel || null });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
65
77
|
let currentId = null;
|
|
66
78
|
let workflowSelectionGeneration = 0;
|
|
67
79
|
const inputDialogFlights = new Map();
|
|
@@ -845,6 +857,50 @@
|
|
|
845
857
|
}
|
|
846
858
|
}
|
|
847
859
|
|
|
860
|
+
/* #1798: the open workflow's display units, in the same Units control the model views show for a project
|
|
861
|
+
(web/model-display-units.js). The server owns the answer: a standalone workflow's own setting, or — for a
|
|
862
|
+
workflow that belongs to a project — the project's. AI Chat reads the same answer for its receipts and replies. */
|
|
863
|
+
function importModelDisplayUnits() { return import('./model-display-units.js'); }
|
|
864
|
+
let workflowUnitsControl = null;
|
|
865
|
+
let workflowUnitsFor = null;
|
|
866
|
+
let workflowUnitsMount = 0;
|
|
867
|
+
async function refreshWorkflowUnits(id) {
|
|
868
|
+
if (!$workflowUnits) return;
|
|
869
|
+
const owner = ownedWorkflowOf(id);
|
|
870
|
+
const owned = owner?.ownedWorkflow || null;
|
|
871
|
+
const workflowId = owned?.workflowId || null;
|
|
872
|
+
if (workflowId && workflowId === workflowUnitsFor && workflowUnitsControl) { void workflowUnitsControl.load(); return; }
|
|
873
|
+
// Every call that gets here starts its own mount; only the newest may finish, so two quick repaints of the
|
|
874
|
+
// same workflow (or A→B→A) never stack two controls in the header.
|
|
875
|
+
const mount = ++workflowUnitsMount;
|
|
876
|
+
workflowUnitsControl?.destroy();
|
|
877
|
+
workflowUnitsControl = null;
|
|
878
|
+
workflowUnitsFor = workflowId;
|
|
879
|
+
$workflowUnits.hidden = !workflowId;
|
|
880
|
+
if (!workflowId) return;
|
|
881
|
+
let module;
|
|
882
|
+
try { module = await importModelDisplayUnits(); }
|
|
883
|
+
catch (error) {
|
|
884
|
+
console.warn('[workflow units] the Units control could not be loaded', error);
|
|
885
|
+
if (mount === workflowUnitsMount) { $workflowUnits.hidden = true; workflowUnitsFor = null; }
|
|
886
|
+
return;
|
|
887
|
+
}
|
|
888
|
+
if (mount !== workflowUnitsMount) return; // a newer call owns the header now
|
|
889
|
+
const project = owned.owner?.kind === 'project' ? (owner.ownerLabel || 'its project') : null;
|
|
890
|
+
const words = (value) => (value === 'mm' ? 'millimetres and kilograms' : 'feet, inches and pounds');
|
|
891
|
+
workflowUnitsControl = module.mountModelDisplayUnits({
|
|
892
|
+
host: $workflowUnits, doc: document, workflowId, commandPrefix: 'canvas', request: api,
|
|
893
|
+
onChange: () => {}, // AI Chat follows the server's copy through floless:display-units-changed
|
|
894
|
+
onError: (message) => showToast(message, 'warn'),
|
|
895
|
+
choiceTip: (value) => (project
|
|
896
|
+
? `Show ${words(value)} across ${project}. This changes the project’s setting, so its other workflows and model views follow.`
|
|
897
|
+
: `Show ${words(value)} in this workflow’s AI Chat`),
|
|
898
|
+
});
|
|
899
|
+
void workflowUnitsControl.load();
|
|
900
|
+
}
|
|
901
|
+
// Any units change (this control, a project's model view, another tab) may be this workflow's — re-read it.
|
|
902
|
+
window.addEventListener('floless:display-units-changed', () => { if (workflowUnitsControl) void workflowUnitsControl.load(); });
|
|
903
|
+
|
|
848
904
|
function paintModes() {
|
|
849
905
|
document.querySelectorAll('.agent-card').forEach((card) => {
|
|
850
906
|
const a = AGENTS[card.dataset.agentId];
|
|
@@ -1133,7 +1189,7 @@
|
|
|
1133
1189
|
}
|
|
1134
1190
|
} else if (currentId) {
|
|
1135
1191
|
body.appId = currentId;
|
|
1136
|
-
const workflowId =
|
|
1192
|
+
const workflowId = ownedWorkflowOf(currentId)?.ownedWorkflow?.workflowId;
|
|
1137
1193
|
if (workflowId) body.workflowId = workflowId;
|
|
1138
1194
|
}
|
|
1139
1195
|
return body;
|
|
@@ -1423,6 +1479,7 @@
|
|
|
1423
1479
|
markSpecialNodes();
|
|
1424
1480
|
paintGate(app);
|
|
1425
1481
|
refreshKbInformed(id); // detached: provenance is additive, and must not hold up the canvas paint
|
|
1482
|
+
void refreshWorkflowUnits(id);
|
|
1426
1483
|
paintBeacon(app); // pulse "Start here" while this workflow is new to the user
|
|
1427
1484
|
refreshDirtyIndicator(); // clean app → dot off; switched back to a dirty one → dot on
|
|
1428
1485
|
renderWfUpdatePill(); // show the "↑ Update to vX" pill when THIS app has a newer published version
|
|
@@ -1489,6 +1546,8 @@
|
|
|
1489
1546
|
try {
|
|
1490
1547
|
({ apps: list } = await api('/api/workflows/library'));
|
|
1491
1548
|
list = list.filter((a) => a.execution !== 'internal');
|
|
1549
|
+
rememberWorkflowOwners(list);
|
|
1550
|
+
wfLibrary = list;
|
|
1492
1551
|
} catch (e) {
|
|
1493
1552
|
if (wasUsable && $wfTrigger) $wfTrigger.disabled = false;
|
|
1494
1553
|
throw e;
|
|
@@ -1502,6 +1561,8 @@
|
|
|
1502
1561
|
currentId = null;
|
|
1503
1562
|
workflowSelectionGeneration += 1;
|
|
1504
1563
|
refreshKbInformed(null); // invalidate any in-flight app read and remove workflow-only provenance
|
|
1564
|
+
void refreshWorkflowUnits(null);
|
|
1565
|
+
notifyChatScope(); // the last workflow went away (archive/delete): AI Chat must let go of it too
|
|
1505
1566
|
$runBtn.disabled = true;
|
|
1506
1567
|
$compileBtn.disabled = true;
|
|
1507
1568
|
if ($menuBakeItem) $menuBakeItem.disabled = true;
|
|
@@ -1510,6 +1571,9 @@
|
|
|
1510
1571
|
paintBeacon(null); // no workflow open → hide the per-workflow beacon
|
|
1511
1572
|
hideSpotlight();
|
|
1512
1573
|
renderCanvasPlaceholder('empty');
|
|
1574
|
+
// #1890: an empty library is where the landing matters most: its New workflow card is the way in.
|
|
1575
|
+
if (!wfLandingBooted) { wfLandingBooted = true; showWorkflowsLanding(true); }
|
|
1576
|
+
else if (wfLanding) renderWorkflowsLanding();
|
|
1513
1577
|
return;
|
|
1514
1578
|
}
|
|
1515
1579
|
const $apps = document.getElementById('apps-count');
|
|
@@ -1529,6 +1593,10 @@
|
|
|
1529
1593
|
if (saved && list.some((a) => a.id === saved)) startId = saved;
|
|
1530
1594
|
} catch { /* ignore */ }
|
|
1531
1595
|
await loadApp(startId);
|
|
1596
|
+
// #1890: the Workflows tab starts on its landing (owner: people start there and tell AI Chat what they want); a
|
|
1597
|
+
// later refresh (rename, delete, apps-changed) keeps whatever is showing.
|
|
1598
|
+
if (!wfLandingBooted) { wfLandingBooted = true; showWorkflowsLanding(true); }
|
|
1599
|
+
else if (wfLanding) renderWorkflowsLanding();
|
|
1532
1600
|
}
|
|
1533
1601
|
|
|
1534
1602
|
// ── Workflow combobox (searchable, provider-grouped) ─────────────────────────
|
|
@@ -1569,10 +1637,16 @@
|
|
|
1569
1637
|
return subject ? `${subject} — FloLess` : 'FloLess Workspace';
|
|
1570
1638
|
}
|
|
1571
1639
|
let wfTitleText = ''; // last workflow-combo label (may be a WF_STATUS_TEXT placeholder)
|
|
1640
|
+
// #1890: the Workflows landing is showing (the tab's home, like the Workspaces landing). The last workflow stays
|
|
1641
|
+
// loaded underneath so picking it again is instant; the chat belongs to the workspace while this is shown.
|
|
1642
|
+
let wfLanding = false;
|
|
1643
|
+
let wfLandingBooted = false;
|
|
1644
|
+
let wfLibrary = [];
|
|
1572
1645
|
let wsTitleName = null; // open Workspaces project name, or 'Workspaces' on its landing; null = Workflows mode
|
|
1573
1646
|
let wsTitleLanding = false; // explicit because a project may itself be named "Workspaces"
|
|
1574
1647
|
let wsTitleProjectId = null; // identity: two projects may legitimately share a display name
|
|
1575
|
-
|
|
1648
|
+
// #1890: on the Workflows landing the tab is named after it, not after the workflow still loaded underneath.
|
|
1649
|
+
const syncTabTitle = () => { document.title = tabTitle(wsTitleName || (wfLanding ? 'Workflows' : null), wfTitleText); };
|
|
1576
1650
|
function setComboTriggerLabel(text) {
|
|
1577
1651
|
if ($wfTriggerLabel) $wfTriggerLabel.textContent = text || 'select workflow';
|
|
1578
1652
|
wfTitleText = text || '';
|
|
@@ -1725,6 +1799,9 @@
|
|
|
1725
1799
|
if (switching) {
|
|
1726
1800
|
$promptSel.value = id;
|
|
1727
1801
|
$promptSel.dispatchEvent(new Event('change', { bubbles: true }));
|
|
1802
|
+
} else if (id && wfLanding) {
|
|
1803
|
+
// #1890: the workflow under the landing is already loaded; picking it only leaves the landing.
|
|
1804
|
+
showWorkflowsLanding(false);
|
|
1728
1805
|
}
|
|
1729
1806
|
setComboTriggerLabel(id);
|
|
1730
1807
|
}
|
|
@@ -5367,7 +5444,7 @@
|
|
|
5367
5444
|
$reportShare.textContent = prev;
|
|
5368
5445
|
}
|
|
5369
5446
|
};
|
|
5370
|
-
$promptSel.onchange = () => { loadApp($promptSel.value).catch(reportErr); };
|
|
5447
|
+
$promptSel.onchange = () => { showWorkflowsLanding(false); loadApp($promptSel.value).catch(reportErr); };
|
|
5371
5448
|
|
|
5372
5449
|
$compileBtn.onclick = async () => {
|
|
5373
5450
|
if (!currentId || $compileBtn.disabled || $compileBtn.hidden) return; // hidden = suppressed for a maintained drift
|
|
@@ -5539,7 +5616,7 @@
|
|
|
5539
5616
|
$graftCancel.setAttribute('data-command-id', 'shell.dialog-cancel#building an agent');
|
|
5540
5617
|
const supported = prefill && GRAFT_KINDS.some((item) => item.kind === prefill.kind)
|
|
5541
5618
|
&& typeof prefill.ref === 'string' && prefill.ref.trim();
|
|
5542
|
-
graftState = { kind: supported ? prefill.kind : 'dlls', ref: supported ? prefill.ref : '', decompile: false, showMore: false, preview: null, stagedRef: null, verifyInFlight: false, commitInFlight: false, onPrimary: runGraftIntrospect, onBack: null };
|
|
5619
|
+
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 };
|
|
5543
5620
|
document.getElementById('graft-title').textContent = 'Graft into agent';
|
|
5544
5621
|
document.getElementById('graft-sub').textContent = 'Choose a DLL, package, or API spec. AWARE will inspect it and prepare command descriptions for your review.';
|
|
5545
5622
|
$graftBack.disabled = false; $graftCancel.disabled = false;
|
|
@@ -5555,6 +5632,7 @@
|
|
|
5555
5632
|
|
|
5556
5633
|
function graftRenderPicker() {
|
|
5557
5634
|
clearGraftInstructorNote();
|
|
5635
|
+
graftState.probe = null; // a check belongs to one inspected source; choosing again starts clean
|
|
5558
5636
|
graftState.onPrimary = runGraftIntrospect;
|
|
5559
5637
|
graftState.onBack = null;
|
|
5560
5638
|
const cfg = graftCfg(graftState.kind);
|
|
@@ -5618,11 +5696,32 @@
|
|
|
5618
5696
|
try {
|
|
5619
5697
|
const body = { sourceKind: graftState.kind, sourceRef: graftState.ref.trim() };
|
|
5620
5698
|
if (cfg.decompile && graftState.decompile) body.decompile = true;
|
|
5699
|
+
if (graftState.probe) body.probe = graftState.probe;
|
|
5621
5700
|
const { preview } = await api('/api/graft/introspect', { method: 'POST', body: JSON.stringify(body) });
|
|
5701
|
+
const askedFor = graftState.probe;
|
|
5622
5702
|
graftState.preview = preview;
|
|
5623
5703
|
graftState.stagedRef = preview.stagedRef;
|
|
5624
5704
|
graftRenderPreview(preview);
|
|
5705
|
+
if (askedFor && !preview.probe) {
|
|
5706
|
+
const note = document.createElement('div');
|
|
5707
|
+
note.className = 'graft-err';
|
|
5708
|
+
note.textContent = `The tool was rebuilt, but it still has no connection check, so ${askedFor} was not added. Choose another command, or create it without a check.`;
|
|
5709
|
+
graftBodyEl().appendChild(note);
|
|
5710
|
+
}
|
|
5625
5711
|
} catch (e) {
|
|
5712
|
+
const triedCheck = graftState.probe;
|
|
5713
|
+
graftState.probe = null; // a refused check must not stick to the next attempt
|
|
5714
|
+
const before = graftState.preview;
|
|
5715
|
+
if (triedCheck && before) {
|
|
5716
|
+
// The tool as it was is still staged: keep showing it, and say only what is known — the
|
|
5717
|
+
// rebuild did not happen — rather than guessing why.
|
|
5718
|
+
graftRenderPreview(before);
|
|
5719
|
+
const err = document.createElement('div');
|
|
5720
|
+
err.className = 'graft-err';
|
|
5721
|
+
err.textContent = `FloLess couldn’t rebuild the tool with ${triedCheck} as its connection check, so nothing changed: this is the tool as it was. Try again, choose another command, or create it without a check.`;
|
|
5722
|
+
graftBodyEl().appendChild(err);
|
|
5723
|
+
return;
|
|
5724
|
+
}
|
|
5626
5725
|
graftRenderPicker(); // restores the entered values from graftState
|
|
5627
5726
|
const msg = (e && e.message) ? e.message : 'Introspection failed';
|
|
5628
5727
|
const err = document.createElement('div');
|
|
@@ -5679,16 +5778,169 @@
|
|
|
5679
5778
|
`<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>` +
|
|
5680
5779
|
`<div id="graft-verify-result" role="status" aria-live="polite"></div></div>` : '';
|
|
5681
5780
|
graftFill(graftBodyEl(),
|
|
5682
|
-
badge + hero + verify + warnings + cmds + skills +
|
|
5781
|
+
badge + hero + verify + graftConnectionHtml(preview) + warnings + cmds + skills +
|
|
5683
5782
|
`<div class="modal-field"><label>Agent name</label><div class="bake-name"><code>${escapeHtml(preview.agentId)}</code></div></div>`);
|
|
5684
5783
|
const verifyButton = document.getElementById('graft-verify-read');
|
|
5685
5784
|
verifyButton?.addEventListener('click', () => runGraftVerifyRead(preview));
|
|
5686
|
-
|
|
5785
|
+
wireGraftAddCheck(preview);
|
|
5786
|
+
if (graftState.focusCheckRow) {
|
|
5787
|
+
graftState.focusCheckRow = false;
|
|
5788
|
+
document.getElementById('graft-check-row')?.focus();
|
|
5789
|
+
} else {
|
|
5790
|
+
verifyButton?.focus();
|
|
5791
|
+
}
|
|
5687
5792
|
graftState.onBack = graftRenderPicker;
|
|
5688
5793
|
graftState.onPrimary = () => runGraftCommit(false);
|
|
5689
5794
|
graftFooter({ backShown: true, primaryLabel: 'Create agent', primaryDisabled: preview.commands.length === 0, primaryCommand: 'shell.graft-create-agent' });
|
|
5690
5795
|
}
|
|
5691
5796
|
|
|
5797
|
+
/** What the tool needs to connect, and its connection check (#1899). Plain words, no internals. */
|
|
5798
|
+
function graftConnectionHtml(preview) {
|
|
5799
|
+
const accounts = Array.isArray(preview.needsAccounts) ? preview.needsAccounts : [];
|
|
5800
|
+
const check = preview.probe;
|
|
5801
|
+
const candidates = Array.isArray(preview.probeCandidates) ? preview.probeCandidates : [];
|
|
5802
|
+
const needs = accounts.length
|
|
5803
|
+
? `<dt>Needs an account</dt><dd>${accounts.map(escapeHtml).join(', ')}</dd>` : '';
|
|
5804
|
+
const checkLine = check
|
|
5805
|
+
? `<dd>${escapeHtml(check.describe || check.command)}</dd>`
|
|
5806
|
+
: `<dd>None yet${candidates.length ? '' : ' — no command can be used for one. You can still connect without a check.'}</dd>`;
|
|
5807
|
+
const add = !check && candidates.length
|
|
5808
|
+
? '<button type="button" class="graft-verify-button" id="graft-add-check" data-command-id="shell.graft-add-check" aria-expanded="false" aria-controls="graft-check-picker">Add a connection check</button>'
|
|
5809
|
+
+ '<div id="graft-check-picker" class="graft-check-picker" hidden></div>'
|
|
5810
|
+
: '';
|
|
5811
|
+
return `<div class="graft-read-review graft-connection" id="graft-check-row" tabindex="-1"><strong>Connecting it</strong>`
|
|
5812
|
+
+ `<dl class="graft-identity">${needs}<dt>Connection check</dt>${checkLine}</dl>${add}</div>`;
|
|
5813
|
+
}
|
|
5814
|
+
|
|
5815
|
+
function wireGraftAddCheck(preview) {
|
|
5816
|
+
const button = document.getElementById('graft-add-check');
|
|
5817
|
+
const picker = document.getElementById('graft-check-picker');
|
|
5818
|
+
if (!button || !picker) return;
|
|
5819
|
+
const close = () => { picker.hidden = true; picker.replaceChildren(); button.setAttribute('aria-expanded', 'false'); button.focus(); };
|
|
5820
|
+
button.addEventListener('click', () => {
|
|
5821
|
+
if (!picker.hidden) { close(); return; }
|
|
5822
|
+
const fieldset = document.createElement('fieldset');
|
|
5823
|
+
fieldset.className = 'conn-choice';
|
|
5824
|
+
const legend = document.createElement('legend');
|
|
5825
|
+
legend.className = 'int-accounts-label';
|
|
5826
|
+
legend.textContent = 'CHOOSE THE COMMAND THAT CHECKS IT';
|
|
5827
|
+
fieldset.append(legend);
|
|
5828
|
+
preview.probeCandidates.forEach((name, index) => {
|
|
5829
|
+
const label = document.createElement('label');
|
|
5830
|
+
label.className = 'conn-choice-option';
|
|
5831
|
+
const input = document.createElement('input');
|
|
5832
|
+
input.type = 'radio'; input.name = 'graft-check'; input.value = name; input.checked = index === 0;
|
|
5833
|
+
input.setAttribute('data-command-id', 'shell.graft-check-command');
|
|
5834
|
+
const command = preview.commands.find((c) => c.name === name);
|
|
5835
|
+
const text = document.createElement('span');
|
|
5836
|
+
text.className = 'conn-choice-text';
|
|
5837
|
+
const code = document.createElement('code');
|
|
5838
|
+
code.className = 'conn-code'; code.textContent = name;
|
|
5839
|
+
const note = document.createElement('span');
|
|
5840
|
+
note.className = 'int-account-origin';
|
|
5841
|
+
note.textContent = command?.summary || 'No description.';
|
|
5842
|
+
text.append(code, note);
|
|
5843
|
+
label.append(input, text);
|
|
5844
|
+
fieldset.append(label);
|
|
5845
|
+
});
|
|
5846
|
+
const warn = document.createElement('p');
|
|
5847
|
+
warn.className = 'graft-hint';
|
|
5848
|
+
warn.textContent = 'FloLess can’t know whether a generated command only reads. Check what it does before you rely on it.';
|
|
5849
|
+
const actions = document.createElement('div');
|
|
5850
|
+
actions.className = 'conn-confirm-actions';
|
|
5851
|
+
const apply = document.createElement('button');
|
|
5852
|
+
apply.type = 'button'; apply.className = 'int-action'; apply.textContent = 'Add this check';
|
|
5853
|
+
apply.setAttribute('data-command-id', 'shell.graft-add-check-apply');
|
|
5854
|
+
const cancel = document.createElement('button');
|
|
5855
|
+
cancel.type = 'button'; cancel.className = 'int-action'; cancel.textContent = 'Cancel';
|
|
5856
|
+
cancel.setAttribute('data-command-id', 'shell.graft-add-check-cancel');
|
|
5857
|
+
actions.append(apply, cancel);
|
|
5858
|
+
picker.replaceChildren(fieldset, warn, actions);
|
|
5859
|
+
picker.hidden = false;
|
|
5860
|
+
button.setAttribute('aria-expanded', 'true');
|
|
5861
|
+
fieldset.querySelector('input')?.focus();
|
|
5862
|
+
cancel.addEventListener('click', close);
|
|
5863
|
+
picker.addEventListener('keydown', (event) => {
|
|
5864
|
+
if (event.key !== 'Escape') return;
|
|
5865
|
+
event.preventDefault(); event.stopPropagation(); close();
|
|
5866
|
+
});
|
|
5867
|
+
apply.addEventListener('click', () => {
|
|
5868
|
+
const chosen = fieldset.querySelector('input:checked')?.value;
|
|
5869
|
+
if (!chosen) return;
|
|
5870
|
+
graftState.probe = chosen;
|
|
5871
|
+
graftState.focusCheckRow = true;
|
|
5872
|
+
void runGraftIntrospect();
|
|
5873
|
+
});
|
|
5874
|
+
});
|
|
5875
|
+
}
|
|
5876
|
+
|
|
5877
|
+
/** After Create: connect what the tool needs, and check that it works — the same check as everywhere. */
|
|
5878
|
+
function graftSuccessActions(preview, agentId) {
|
|
5879
|
+
const wrap = document.createElement('div');
|
|
5880
|
+
wrap.className = 'graft-success-actions';
|
|
5881
|
+
const status = document.createElement('div');
|
|
5882
|
+
status.className = 'graft-hint';
|
|
5883
|
+
status.setAttribute('role', 'status');
|
|
5884
|
+
const actions = document.createElement('div');
|
|
5885
|
+
actions.className = 'conn-confirm-actions';
|
|
5886
|
+
const keys = document.createElement('div');
|
|
5887
|
+
keys.className = 'graft-hint';
|
|
5888
|
+
// Each account the tool needs goes where it is given: a sign-in to its Integrations card, a key to
|
|
5889
|
+
// the terminal command that stores it. Which is which comes from the services list, not the name.
|
|
5890
|
+
const needs = preview?.needsAccounts || [];
|
|
5891
|
+
const placeAccounts = (services) => {
|
|
5892
|
+
if (!services) {
|
|
5893
|
+
// The list didn't load, so FloLess can't tell a sign-in from a key: say both, guess neither.
|
|
5894
|
+
for (const account of needs) {
|
|
5895
|
+
const line = document.createElement('p');
|
|
5896
|
+
line.append(`FloLess couldn’t tell how ${account} connects. If it signs in, connect it in Integrations; if it uses a key, run this in a terminal: `);
|
|
5897
|
+
const code = document.createElement('code');
|
|
5898
|
+
code.className = 'conn-code'; code.textContent = `aware credential put ${account}`;
|
|
5899
|
+
line.append(code);
|
|
5900
|
+
keys.append(line);
|
|
5901
|
+
}
|
|
5902
|
+
return;
|
|
5903
|
+
}
|
|
5904
|
+
for (const account of needs) {
|
|
5905
|
+
const service = services.find((row) => row.id === account || account.startsWith(`${row.id}.`));
|
|
5906
|
+
if (service?.kind === 'key' || (!service && services.length)) {
|
|
5907
|
+
if (service?.connected) continue;
|
|
5908
|
+
const line = document.createElement('p');
|
|
5909
|
+
line.append(`This tool needs a key. Run this in a terminal, then paste your key when it asks: `);
|
|
5910
|
+
const code = document.createElement('code');
|
|
5911
|
+
code.className = 'conn-code'; code.textContent = `aware credential put ${account}`;
|
|
5912
|
+
line.append(code);
|
|
5913
|
+
keys.append(line);
|
|
5914
|
+
continue;
|
|
5915
|
+
}
|
|
5916
|
+
const target = service?.id ?? '';
|
|
5917
|
+
const label = service?.name ?? account;
|
|
5918
|
+
const connect = document.createElement('button');
|
|
5919
|
+
connect.type = 'button'; connect.className = 'int-action';
|
|
5920
|
+
connect.textContent = `Connect ${label}`;
|
|
5921
|
+
connect.setAttribute('data-command-id', `shell.graft-connect-service#${target || account}`);
|
|
5922
|
+
connect.setAttribute('data-command-instance-label', label);
|
|
5923
|
+
connect.addEventListener('click', () => { closeGraftModal(); openIntegrations(target); });
|
|
5924
|
+
actions.prepend(connect);
|
|
5925
|
+
}
|
|
5926
|
+
};
|
|
5927
|
+
if (needs.length) {
|
|
5928
|
+
const services = window.flolessConnections?.loadServices();
|
|
5929
|
+
if (services) services.then(placeAccounts, () => placeAccounts(null)); else placeAccounts(null);
|
|
5930
|
+
}
|
|
5931
|
+
const confirmHost = document.createElement('div');
|
|
5932
|
+
const receiptHost = document.createElement('div');
|
|
5933
|
+
receiptHost.setAttribute('role', 'status');
|
|
5934
|
+
if (preview?.probe && window.flolessConnections) {
|
|
5935
|
+
actions.append(window.flolessConnections.checkButton({
|
|
5936
|
+
agent: agentId, label: agentId, receiptHost, confirmHost, announce: (text) => { status.textContent = text; },
|
|
5937
|
+
}));
|
|
5938
|
+
}
|
|
5939
|
+
if (!actions.childElementCount && !needs.length) return null;
|
|
5940
|
+
wrap.append(actions, keys, confirmHost, receiptHost, status);
|
|
5941
|
+
return wrap;
|
|
5942
|
+
}
|
|
5943
|
+
|
|
5692
5944
|
function graftTeklaReadErrorMessage(error) {
|
|
5693
5945
|
const body = error?.body;
|
|
5694
5946
|
if (error?.status === 402 || body?.error === 'subscription required') {
|
|
@@ -5826,7 +6078,10 @@
|
|
|
5826
6078
|
const body = { stagedRef: graftState.stagedRef };
|
|
5827
6079
|
if (force) body.force = true;
|
|
5828
6080
|
const res = await api('/api/graft/commit', { method: 'POST', body: JSON.stringify(body) });
|
|
5829
|
-
graftFill(graftBodyEl(), `<div class="graft-success"><div class="gs-icon">⊕</div><div class="gs-msg">Agent created — now in the Agents library as <code>${escapeHtml(res.agentId)}</code>.</div></div>`);
|
|
6081
|
+
graftFill(graftBodyEl(), `<div class="graft-success"><div class="gs-icon">⊕</div><div class="gs-msg" id="graft-success-msg" tabindex="-1">Agent created — now in the Agents library as <code>${escapeHtml(res.agentId)}</code>.</div></div>`);
|
|
6082
|
+
const nextSteps = graftSuccessActions(graftState.preview, res.agentId);
|
|
6083
|
+
if (nextSteps) graftBodyEl().append(nextSteps);
|
|
6084
|
+
document.getElementById('graft-success-msg')?.focus();
|
|
5830
6085
|
$graftBack.hidden = true; $graftCancel.disabled = false; $graftPrimary.textContent = 'Done'; $graftPrimary.disabled = false;
|
|
5831
6086
|
$graftPrimary.setAttribute('data-command-id', 'shell.graft-done');
|
|
5832
6087
|
graftState.onPrimary = closeGraftModal;
|
|
@@ -11836,6 +12091,17 @@
|
|
|
11836
12091
|
window.dispatchEvent(new CustomEvent('floless:revit-capability-changed'));
|
|
11837
12092
|
});
|
|
11838
12093
|
|
|
12094
|
+
// Drawing Checker's locked card asks the same account gate, under its own name — never Tekla's.
|
|
12095
|
+
window.addEventListener('floless:open-drawing-check-access', async (event) => {
|
|
12096
|
+
const state = event.detail?.state;
|
|
12097
|
+
if (state === 'account-selection-required') {
|
|
12098
|
+
await recheckLicenseAndGate({ forRevitAccountSelection: true, moduleLabel: 'Drawing Checker' });
|
|
12099
|
+
} else {
|
|
12100
|
+
await recheckLicenseAndGate();
|
|
12101
|
+
}
|
|
12102
|
+
window.dispatchEvent(new CustomEvent('floless:revit-capability-changed'));
|
|
12103
|
+
});
|
|
12104
|
+
|
|
11839
12105
|
function runtimeSectionSummary(runtimes, active, folder) {
|
|
11840
12106
|
// What FloLess would LAUNCH (#1622): its own copy where it runs one, else the user's install.
|
|
11841
12107
|
const installed = runtimes.filter(runtimeCopyInstalled);
|
|
@@ -12283,7 +12549,7 @@
|
|
|
12283
12549
|
const badge = i.status === 'connected' ? 'Connected' : i.status === 'expired' ? 'Token expired' : 'Not connected';
|
|
12284
12550
|
const meta = i.status === 'disconnected' ? '—' : i.expiresAt ? `expires ${new Date(i.expiresAt).toLocaleString()}` : 'connected';
|
|
12285
12551
|
return `
|
|
12286
|
-
<div class="int-item int-${i.status}">
|
|
12552
|
+
<div class="int-item int-${i.status}" data-integration-id="${escapeAttr(i.id)}" tabindex="-1">
|
|
12287
12553
|
<div class="int-icon" aria-hidden="true">${escapeHtml(VENDOR_ICON[i.vendor] || (i.name[0] || '?'))}</div>
|
|
12288
12554
|
<div class="int-info">
|
|
12289
12555
|
<div class="int-name">${escapeHtml(i.name)}</div>
|
|
@@ -12291,6 +12557,7 @@
|
|
|
12291
12557
|
<div class="int-scopes">${escapeHtml((i.network || []).join(' · ') || '—')}</div>
|
|
12292
12558
|
<div class="int-meta">${escapeHtml(meta)}</div>
|
|
12293
12559
|
${renderIntegrationAccounts(i)}
|
|
12560
|
+
<div class="conn-int" data-conn-int="${escapeAttr(i.id)}"></div>
|
|
12294
12561
|
<div class="int-row">
|
|
12295
12562
|
<span class="int-badge int-badge-${i.status}">${badge}</span>
|
|
12296
12563
|
<button class="int-action" data-int="${escapeAttr(i.id)}" data-int-action="${action.toLowerCase()}">${action}</button>
|
|
@@ -12304,6 +12571,7 @@
|
|
|
12304
12571
|
</div>`;
|
|
12305
12572
|
}).join('');
|
|
12306
12573
|
offerClippedScopeLines($integrationsList);
|
|
12574
|
+
void decorateIntegrationConnections();
|
|
12307
12575
|
$integrationsList.querySelectorAll('[data-xeorvt-action]').forEach((btn) => {
|
|
12308
12576
|
btn.onclick = async () => {
|
|
12309
12577
|
if (btn.dataset.xeorvtAction === 'open') {
|
|
@@ -12365,6 +12633,69 @@
|
|
|
12365
12633
|
});
|
|
12366
12634
|
};
|
|
12367
12635
|
|
|
12636
|
+
/**
|
|
12637
|
+
* #1899: under each service card, the account FloLess uses and the generic "Check it works".
|
|
12638
|
+
* Filled after the card list paints, from the services inventory; a failure leaves the cards as
|
|
12639
|
+
* they were and says so once in the window's status line.
|
|
12640
|
+
*/
|
|
12641
|
+
let integrationConnectionsGeneration = 0;
|
|
12642
|
+
async function decorateIntegrationConnections() {
|
|
12643
|
+
const connections = window.flolessConnections;
|
|
12644
|
+
if (!connections) return;
|
|
12645
|
+
const generation = ++integrationConnectionsGeneration;
|
|
12646
|
+
const status = document.getElementById('integrations-status');
|
|
12647
|
+
const announce = (text) => { if (status) status.textContent = text; };
|
|
12648
|
+
let services;
|
|
12649
|
+
try {
|
|
12650
|
+
// Receipts only add "Verified" to what is shown; without them every check still works.
|
|
12651
|
+
[services] = await Promise.all([connections.loadServices(), connections.loadReceipts().catch(() => null)]);
|
|
12652
|
+
} catch (error) {
|
|
12653
|
+
if (generation === integrationConnectionsGeneration) announce(connections.sentenceOf(error));
|
|
12654
|
+
return;
|
|
12655
|
+
}
|
|
12656
|
+
if (generation !== integrationConnectionsGeneration) return;
|
|
12657
|
+
if (services.choicesUnreadable) announce('FloLess couldn’t read your saved account choices, so each service shows Not chosen. Close Integrations and open it again.');
|
|
12658
|
+
for (const service of services) {
|
|
12659
|
+
const id = (window.CSS && CSS.escape) ? CSS.escape(service.id) : service.id;
|
|
12660
|
+
let slot = $integrationsList.querySelector(`.conn-int[data-conn-int="${id}"]`);
|
|
12661
|
+
// A tool's own key (no sign-in, not in the list above) still gets a card: its account choice and
|
|
12662
|
+
// check live here like every other service's.
|
|
12663
|
+
if (!slot && service.kind === 'key') slot = keyServiceCard(service);
|
|
12664
|
+
if (!slot) continue;
|
|
12665
|
+
slot.replaceChildren(connections.serviceConnectionNode(service));
|
|
12666
|
+
}
|
|
12667
|
+
}
|
|
12668
|
+
|
|
12669
|
+
/** A card for a key service: its name, how to save the key, and the slot the connection UI fills. */
|
|
12670
|
+
function keyServiceCard(service) {
|
|
12671
|
+
const card = document.createElement('div');
|
|
12672
|
+
card.className = `int-item int-${service.connected ? 'connected' : 'disconnected'}`;
|
|
12673
|
+
card.dataset.integrationId = service.id;
|
|
12674
|
+
card.tabIndex = -1;
|
|
12675
|
+
const icon = document.createElement('div');
|
|
12676
|
+
icon.className = 'int-icon'; icon.setAttribute('aria-hidden', 'true');
|
|
12677
|
+
icon.textContent = (service.name || '?')[0];
|
|
12678
|
+
const info = document.createElement('div');
|
|
12679
|
+
info.className = 'int-info';
|
|
12680
|
+
const name = document.createElement('div');
|
|
12681
|
+
name.className = 'int-name'; name.textContent = service.name;
|
|
12682
|
+
const kind = document.createElement('div');
|
|
12683
|
+
kind.className = 'int-kind';
|
|
12684
|
+
kind.textContent = service.connected ? 'A key you saved for this tool' : 'Needs a key from the service. Run this in a terminal, then paste your key when it asks:';
|
|
12685
|
+
info.append(name, kind);
|
|
12686
|
+
if (!service.connected) {
|
|
12687
|
+
const code = document.createElement('code');
|
|
12688
|
+
code.className = 'conn-code'; code.textContent = `aware credential put ${service.id}`;
|
|
12689
|
+
info.append(code);
|
|
12690
|
+
}
|
|
12691
|
+
const slot = document.createElement('div');
|
|
12692
|
+
slot.className = 'conn-int'; slot.dataset.connInt = service.id;
|
|
12693
|
+
info.append(slot);
|
|
12694
|
+
card.append(icon, info);
|
|
12695
|
+
$integrationsList.append(card);
|
|
12696
|
+
return slot;
|
|
12697
|
+
}
|
|
12698
|
+
|
|
12368
12699
|
// Device-code sign-in: ask the server to start `aware connect --device-code`,
|
|
12369
12700
|
// show the user the code + verification URL, then wait for the SSE result.
|
|
12370
12701
|
// `connecting` guards against duplicate clicks spawning parallel polls.
|
|
@@ -12507,9 +12838,17 @@
|
|
|
12507
12838
|
const epoch = (completeReportDiscoveryEpoch.get(id) || 0) + 1;
|
|
12508
12839
|
completeReportDiscoveryEpoch.set(id, epoch);
|
|
12509
12840
|
const previous = completeReportDiscovery.get(id);
|
|
12510
|
-
|
|
12511
|
-
if (
|
|
12841
|
+
// A row already saying "being prepared" keeps saying it while it asks again (no flicker).
|
|
12842
|
+
if (!previous?.starting) {
|
|
12843
|
+
completeReportDiscovery.set(id, { checking: true });
|
|
12844
|
+
if ($routinesModal.classList.contains('show')) renderRoutinesList();
|
|
12845
|
+
}
|
|
12512
12846
|
try {
|
|
12847
|
+
const starting = await savedReportsStillStarting();
|
|
12848
|
+
if (starting) {
|
|
12849
|
+
if (completeReportDiscoveryEpoch.get(id) !== epoch) return null;
|
|
12850
|
+
return noteReportStillStarting(id, epoch, previous, starting === 'paused');
|
|
12851
|
+
}
|
|
12513
12852
|
const canHttpBootstrap = await ensureReportDiscoverySession();
|
|
12514
12853
|
let result;
|
|
12515
12854
|
try { result = await api(`/api/routines/${encodeURIComponent(id)}/complete-report`); }
|
|
@@ -12531,6 +12870,12 @@
|
|
|
12531
12870
|
return result;
|
|
12532
12871
|
} catch (error) {
|
|
12533
12872
|
if (completeReportDiscoveryEpoch.get(id) !== epoch) return null;
|
|
12873
|
+
if (error.body?.code === 'model-report-recovery-pending') {
|
|
12874
|
+
// Reports were paused again after start-up (a later check failed): same neutral, self-retrying
|
|
12875
|
+
// row, and the cached report stays — "not ready yet" is not evidence that it is gone.
|
|
12876
|
+
reportsMaybeStarting = true;
|
|
12877
|
+
return noteReportStillStarting(id, epoch, previous, true);
|
|
12878
|
+
}
|
|
12534
12879
|
const message = error.status === 401 ? 'Sign in again to view saved reports.'
|
|
12535
12880
|
: 'Could not check this report. Check your access and try again.';
|
|
12536
12881
|
completeReportDiscovery.set(id, { error: message });
|
|
@@ -12547,6 +12892,51 @@
|
|
|
12547
12892
|
return null;
|
|
12548
12893
|
}
|
|
12549
12894
|
|
|
12895
|
+
// Saved model reports are verified AFTER the server starts listening (#1826), so for a while after
|
|
12896
|
+
// FloLess starts, report discovery is not ready yet. That is a normal state, not an access problem:
|
|
12897
|
+
// a routine's row says so in neutral words and asks again on its own.
|
|
12898
|
+
const REPORT_STARTING_NOTE = 'Getting your saved report ready… This updates on its own.';
|
|
12899
|
+
const REPORT_STARTING_STUCK_NOTE = 'Your saved report is still being prepared. FloLess keeps checking; if this does not clear, use Report an issue.';
|
|
12900
|
+
const REPORT_STARTING_STUCK_AFTER_MS = 10 * 60 * 1000;
|
|
12901
|
+
// True until /api/health says saved reports are ready. While it may be false we ask health first, so
|
|
12902
|
+
// a page opened during start-up never sends a discovery request that would only be refused.
|
|
12903
|
+
let reportsMaybeStarting = true;
|
|
12904
|
+
|
|
12905
|
+
/** null when saved reports are ready (or health cannot say); otherwise 'checking' or 'paused'. */
|
|
12906
|
+
async function savedReportsStillStarting() {
|
|
12907
|
+
if (!reportsMaybeStarting) return null;
|
|
12908
|
+
try {
|
|
12909
|
+
const response = await fetch('/api/health', { cache: 'no-store' });
|
|
12910
|
+
if (!response.ok) return null;
|
|
12911
|
+
const state = (await response.json())?.startup?.reports;
|
|
12912
|
+
// An older server has no startup field: it only ever answers once reports are ready.
|
|
12913
|
+
if (state === undefined || state === 'ready') { reportsMaybeStarting = false; return null; }
|
|
12914
|
+
return state === 'paused' ? 'paused' : 'checking';
|
|
12915
|
+
} catch { return null; } // the discovery request below then reports any real problem
|
|
12916
|
+
}
|
|
12917
|
+
|
|
12918
|
+
/** Show the neutral "being prepared" row and ask again later; superseded by any newer refresh. */
|
|
12919
|
+
function noteReportStillStarting(id, epoch, previous, paused) {
|
|
12920
|
+
const attempts = previous?.starting ? previous.attempts + 1 : 0;
|
|
12921
|
+
const startingSince = previous?.starting ? previous.startingSince : Date.now();
|
|
12922
|
+
// "paused" means the server already knows a check failed and is retrying: say so at once.
|
|
12923
|
+
const stuck = paused || Date.now() - startingSince > REPORT_STARTING_STUCK_AFTER_MS;
|
|
12924
|
+
const next = { starting: true, attempts, startingSince, note: stuck ? REPORT_STARTING_STUCK_NOTE : REPORT_STARTING_NOTE };
|
|
12925
|
+
completeReportDiscovery.set(id, next);
|
|
12926
|
+
// Repaint only when what the row says changes, so a screen reader is not told the same thing again
|
|
12927
|
+
// on every retry.
|
|
12928
|
+
if ($routinesModal.classList.contains('show') && previous?.note !== next.note) renderRoutinesList();
|
|
12929
|
+
// Ask again only while the Routines list is open. Closed, nothing shows the row; reopening it, the
|
|
12930
|
+
// server's "reports ready" broadcast, and View report all check again anyway.
|
|
12931
|
+
const delay = Math.min(5000 * 2 ** attempts, 30_000);
|
|
12932
|
+
setTimeout(() => {
|
|
12933
|
+
if (completeReportDiscoveryEpoch.get(id) === epoch && $routinesModal.classList.contains('show')) {
|
|
12934
|
+
void refreshRoutineReportDiscovery(id);
|
|
12935
|
+
}
|
|
12936
|
+
}, delay);
|
|
12937
|
+
return next;
|
|
12938
|
+
}
|
|
12939
|
+
|
|
12550
12940
|
async function viewScheduledCompleteReport(id) {
|
|
12551
12941
|
const r = routinesData.find((item) => item.id === id);
|
|
12552
12942
|
if (!isCompleteReportRoutine(r)) return;
|
|
@@ -12554,6 +12944,10 @@
|
|
|
12554
12944
|
if (currentId !== r.workflow) return;
|
|
12555
12945
|
// Recheck at the moment of opening; a cached handle is never an authorization grant.
|
|
12556
12946
|
const state = await refreshRoutineReportDiscovery(id);
|
|
12947
|
+
if (state?.starting) {
|
|
12948
|
+
showToast('Your saved report is still being prepared. It will be ready in a moment.', 'info');
|
|
12949
|
+
return;
|
|
12950
|
+
}
|
|
12557
12951
|
if (!state?.report) {
|
|
12558
12952
|
showToast('This saved report is no longer available. Check your access or run the routine again.', 'warn');
|
|
12559
12953
|
return;
|
|
@@ -12984,7 +13378,9 @@
|
|
|
12984
13378
|
const isTrigger = r.kind === 'trigger';
|
|
12985
13379
|
const isCompleteReport = isCompleteReportRoutine(r);
|
|
12986
13380
|
const discovery = isCompleteReport ? completeReportDiscovery.get(r.id) : null;
|
|
12987
|
-
const reportLine = !isCompleteReport ? '' : discovery?.
|
|
13381
|
+
const reportLine = !isCompleteReport ? '' : discovery?.starting
|
|
13382
|
+
? `<div class="rtn-report-note" role="status">${escapeHtml(discovery.note)}</div>`
|
|
13383
|
+
: discovery?.checking
|
|
12988
13384
|
? '<div class="rtn-report-note">Checking saved report access…</div>'
|
|
12989
13385
|
: discovery?.error
|
|
12990
13386
|
? `<div class="rtn-report-note warn" role="status">${escapeHtml(discovery.error)}</div>`
|
|
@@ -14252,20 +14648,103 @@
|
|
|
14252
14648
|
// loads AFTER this file and reuses these seams instead of duplicating the fetch /
|
|
14253
14649
|
// report-viewer plumbing — the renderer composes nothing itself. Kept minimal on
|
|
14254
14650
|
// purpose; widen only when a panel block genuinely needs another seam.
|
|
14651
|
+
// #1890: AI Chat is always on. Where no project or owned workflow is open — the Workspaces landing, the Workflows
|
|
14652
|
+
// landing, an installed (not owned) workflow — the conversation belongs to the workspace, with what is open as context.
|
|
14255
14653
|
function currentChatScope() {
|
|
14256
14654
|
if (wsTitleName) {
|
|
14257
|
-
if (wsTitleLanding || !wsTitleProjectId) return
|
|
14655
|
+
if (wsTitleLanding || !wsTitleProjectId) return { owner: { kind: 'workspace' }, label: 'All projects and workflows' };
|
|
14258
14656
|
return { owner: { kind: 'project', projectId: wsTitleProjectId }, label: wsTitleName };
|
|
14259
14657
|
}
|
|
14658
|
+
if (wfLanding || !currentId) return { owner: { kind: 'workspace' }, label: 'All projects and workflows' };
|
|
14260
14659
|
const app = currentId ? apps.get(currentId) : null;
|
|
14261
|
-
const owned =
|
|
14262
|
-
if (!owned?.workflowId)
|
|
14660
|
+
const owned = ownedWorkflowOf(currentId)?.ownedWorkflow;
|
|
14661
|
+
if (!owned?.workflowId) {
|
|
14662
|
+
const name = app?.displayName || app?.name || currentId;
|
|
14663
|
+
return { owner: { kind: 'workspace' }, label: `With ${name}` };
|
|
14664
|
+
}
|
|
14263
14665
|
return {
|
|
14264
14666
|
owner: { kind: 'workflow', workflowId: owned.workflowId },
|
|
14265
|
-
label: owned.displayName || app
|
|
14667
|
+
label: owned.displayName || app?.displayName || currentId,
|
|
14266
14668
|
};
|
|
14267
14669
|
}
|
|
14268
14670
|
|
|
14671
|
+
// ── Workflows landing (#1890) ─────────────────────────────────────────────────
|
|
14672
|
+
// The Workflows tab's home, the counterpart of the Workspaces landing: a create card and one card per workflow. It
|
|
14673
|
+
// renders AWARE's library listing; it composes nothing.
|
|
14674
|
+
const $wfLanding = document.getElementById('wf-landing');
|
|
14675
|
+
function showWorkflowsLanding(on) {
|
|
14676
|
+
const next = Boolean(on);
|
|
14677
|
+
if (next === wfLanding && (!next || $wfLanding?.childElementCount)) { if (next) renderWorkflowsLanding(); return; }
|
|
14678
|
+
wfLanding = next;
|
|
14679
|
+
document.body.classList.toggle('wf-landing-open', wfLanding);
|
|
14680
|
+
if ($wfLanding) $wfLanding.hidden = !wfLanding;
|
|
14681
|
+
if (wfLanding) { hideSpotlight(); renderWorkflowsLanding(); }
|
|
14682
|
+
syncTabTitle();
|
|
14683
|
+
notifyChatScope();
|
|
14684
|
+
}
|
|
14685
|
+
|
|
14686
|
+
function workflowCardMeta(row) {
|
|
14687
|
+
const nodes = Number(row.nodes) || 0;
|
|
14688
|
+
const provider = PROVIDER_LABELS[row.provider] || row.provider || '';
|
|
14689
|
+
return `${nodes} node${nodes === 1 ? '' : 's'}${provider ? ` · ${provider}` : ''}`;
|
|
14690
|
+
}
|
|
14691
|
+
|
|
14692
|
+
function renderWorkflowsLanding() {
|
|
14693
|
+
if (!$wfLanding) return;
|
|
14694
|
+
const focusedId = document.activeElement?.closest?.('#wf-landing [data-wf-id]')?.dataset.wfId || null;
|
|
14695
|
+
const esc = (s) => String(s ?? '').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"');
|
|
14696
|
+
const owned = wfLibrary.filter((row) => row.ownedWorkflow);
|
|
14697
|
+
const installed = wfLibrary.filter((row) => !row.ownedWorkflow);
|
|
14698
|
+
const card = (row) => {
|
|
14699
|
+
const ownedRow = row.ownedWorkflow;
|
|
14700
|
+
const name = ownedRow ? ownedRow.displayName : (row.displayName || row.name || row.id);
|
|
14701
|
+
const chip = ownedRow ? 'Yours' : 'Installed';
|
|
14702
|
+
const where = ownedRow ? (row.ownerLabel || 'Standalone') : (PROVIDER_LABELS[row.provider] || 'Installed workflow');
|
|
14703
|
+
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
|
+
+ `<div class="ws-body"><div class="wf-card-text"><span class="ws-kind wf-kind">${chip}</span>`
|
|
14705
|
+
+ `<div class="ws-name">${esc(name)}</div><div class="ws-meta">${esc(where)}</div>`
|
|
14706
|
+
+ `<div class="ws-meta wf-card-nodes">${esc(workflowCardMeta(row))}</div></div></div></div>`;
|
|
14707
|
+
};
|
|
14708
|
+
const group = (title, rows, show) => (rows.length
|
|
14709
|
+
? `${show ? `<div class="wf-group-label">${esc(title)} (${rows.length})</div>` : ''}<div class="ws-grid">${rows.map(card).join('')}</div>` : '');
|
|
14710
|
+
const both = owned.length > 0 && installed.length > 0;
|
|
14711
|
+
$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></div>`
|
|
14713
|
+
+ `<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
|
+
+ `<div class="ws-thumb">+</div><div class="ws-body"><div><div class="ws-name">New workflow</div>`
|
|
14715
|
+
+ `<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
|
+
? group('Your workflows', owned, both) + group('Installed', installed, both)
|
|
14718
|
+
: '<div class="ws-empty-note">No workflows yet. Start with New workflow, or ask AI Chat on the left.</div>');
|
|
14719
|
+
if (focusedId) $wfLanding.querySelector(`[data-wf-id="${CSS.escape(focusedId)}"]`)?.focus();
|
|
14720
|
+
}
|
|
14721
|
+
|
|
14722
|
+
// One card opens at a time: loadApp has no ordering of its own, so a second quick click could land first and then
|
|
14723
|
+
// be overwritten by the slower first one.
|
|
14724
|
+
let landingOpening = false;
|
|
14725
|
+
function openWorkflowFromLanding(id) {
|
|
14726
|
+
if (!id || landingOpening || !wfLibrary.some((row) => row.id === id)) return;
|
|
14727
|
+
landingOpening = true;
|
|
14728
|
+
// Leave the landing once the workflow has loaded, so the previous one never flashes up in between; a failed
|
|
14729
|
+
// load keeps the landing and reports why.
|
|
14730
|
+
loadApp(id).then(() => showWorkflowsLanding(false)).catch(reportErr).finally(() => { landingOpening = false; });
|
|
14731
|
+
}
|
|
14732
|
+
|
|
14733
|
+
if ($wfLanding) {
|
|
14734
|
+
$wfLanding.addEventListener('click', (event) => {
|
|
14735
|
+
if (event.target.closest('[data-wf-new]')) { requestNewWorkflow(); return; }
|
|
14736
|
+
const cardEl = event.target.closest('[data-wf-id]');
|
|
14737
|
+
if (cardEl) openWorkflowFromLanding(cardEl.dataset.wfId);
|
|
14738
|
+
});
|
|
14739
|
+
$wfLanding.addEventListener('keydown', (event) => {
|
|
14740
|
+
if (event.key !== 'Enter' && event.key !== ' ') return;
|
|
14741
|
+
const target = event.target.closest('[data-wf-id], [data-wf-new]');
|
|
14742
|
+
if (!target || target !== event.target) return;
|
|
14743
|
+
event.preventDefault();
|
|
14744
|
+
target.click();
|
|
14745
|
+
});
|
|
14746
|
+
}
|
|
14747
|
+
|
|
14269
14748
|
function notifyChatScope() {
|
|
14270
14749
|
window.dispatchEvent(new CustomEvent('floless:chat-scope-changed', { detail: currentChatScope() }));
|
|
14271
14750
|
}
|
|
@@ -14375,7 +14854,7 @@
|
|
|
14375
14854
|
},
|
|
14376
14855
|
// The steel editor's Ask AI list: an AI the user installed that the server approved for read-only runs
|
|
14377
14856
|
// (`canRunReadOnly`). Its start sets nothing up first, so FloLess's own copy is not offered there yet
|
|
14378
|
-
// (#1652).
|
|
14857
|
+
// (#1652).
|
|
14379
14858
|
async readOnlyRequestOptions() {
|
|
14380
14859
|
const info = await refreshHeadless();
|
|
14381
14860
|
return {
|
|
@@ -14383,22 +14862,6 @@
|
|
|
14383
14862
|
found: headlessRuntimes().filter((runtime) => runtime && runtime.state === 'found' && runtime.canRunReadOnly === true),
|
|
14384
14863
|
};
|
|
14385
14864
|
},
|
|
14386
|
-
// The Drawing Filter's read before it sends (#1650): what launching the conversation's OWN AI would
|
|
14387
|
-
// see now, from a read of its own (readChatRuntimeLaunch), never the shared rows a surface was painted
|
|
14388
|
-
// from, which can predate FloLess's own copy going away. One read, as before, so Send waits no longer.
|
|
14389
|
-
// 'ready' it can start;
|
|
14390
|
-
// 'setup' FloLess has to set its own copy up first (not installed, being set up, gone, or a
|
|
14391
|
-
// failure it can retry);
|
|
14392
|
-
// 'unavailable' it cannot answer Drawing Filter messages on this computer (nothing FloLess can
|
|
14393
|
-
// start, or not approved for read-only runs);
|
|
14394
|
-
// 'unchecked' the read failed, so nothing is known.
|
|
14395
|
-
async filterRuntimeLaunch(provider) {
|
|
14396
|
-
const launch = await readChatRuntimeLaunch(provider);
|
|
14397
|
-
if (launch.failed) return { readiness: 'unchecked' };
|
|
14398
|
-
if (launch.missing) return { readiness: 'unavailable' };
|
|
14399
|
-
const readiness = chatRuntimeReadiness(launch.row);
|
|
14400
|
-
return { readiness: readiness !== 'unavailable' && launch.row.canRunReadOnly === true ? readiness : 'unavailable' };
|
|
14401
|
-
},
|
|
14402
14865
|
showRequestQueuedModal,
|
|
14403
14866
|
formModal, // the shared styled prompt/form modal — workspaces.js reuses it (never a native prompt)
|
|
14404
14867
|
// One owner for runtime upgrades. Workspaces may open this surface but must
|
|
@@ -14431,6 +14894,12 @@
|
|
|
14431
14894
|
getChatScope() {
|
|
14432
14895
|
return currentChatScope();
|
|
14433
14896
|
},
|
|
14897
|
+
// #1890: the active Workflows tab is the way home to the Workflows landing (as Workspaces' is to its own).
|
|
14898
|
+
showWorkflowsLanding() {
|
|
14899
|
+
showWorkflowsLanding(true);
|
|
14900
|
+
document.getElementById('wf-landing-title')?.focus();
|
|
14901
|
+
},
|
|
14902
|
+
isWorkflowsLanding() { return wfLanding; },
|
|
14434
14903
|
revealAiChat() {
|
|
14435
14904
|
window.flolessLeftPane?.showSection?.('narrative');
|
|
14436
14905
|
if (state.collapse.left) {
|
|
@@ -14444,20 +14913,21 @@
|
|
|
14444
14913
|
|| request.run?.handoffReady || request.run?.recoveryReady || request.run?.processContained === false));
|
|
14445
14914
|
},
|
|
14446
14915
|
// #1776: the drawing read AI Chat is running in this conversation (a revision-read, or a rebake,
|
|
14447
|
-
// which is a read too),
|
|
14448
|
-
// be
|
|
14449
|
-
//
|
|
14450
|
-
//
|
|
14451
|
-
//
|
|
14452
|
-
//
|
|
14453
|
-
//
|
|
14454
|
-
//
|
|
14916
|
+
// which is a read too), at EVERY stage until it finishes — the only listener a message typed there
|
|
14917
|
+
// can be meant for. Server-owned facts only: the read's own chat link (`executionOwner: 'chat'`)
|
|
14918
|
+
// and its status.
|
|
14919
|
+
//
|
|
14920
|
+
// That includes a read whose Drawing Filter is prepared but not yet saved (#1855): the read asks the
|
|
14921
|
+
// person things exactly there — "should I use 1/4" = 1'-0" for these sheets?" — and the answer is a turn
|
|
14922
|
+
// in this conversation. Since #1859 there is one AI Chat and no separate Drawing Filter AI, so this only
|
|
14923
|
+
// names where a message goes; the composer's hint says so. A read whose chat reply failed or was
|
|
14924
|
+
// interrupted claims it too: the Requests window tells the person to ask that conversation to try again
|
|
14925
|
+
// or continue. (Recovery and archived conversations disable the composer, so they never get here.)
|
|
14455
14926
|
readInChat(chatId) {
|
|
14456
14927
|
if (!chatId) return null;
|
|
14457
14928
|
const read = pendingRequests.find((request) => request
|
|
14458
14929
|
&& (request.type === 'revision-read' || request.type === 'rebake') && request.status === 'pending'
|
|
14459
|
-
&& request.chatConversation?.executionOwner === 'chat' && request.chatConversation.chatId === chatId
|
|
14460
|
-
&& !(request.prepassReady && !request.filterCheckpointCurrent));
|
|
14930
|
+
&& request.chatConversation?.executionOwner === 'chat' && request.chatConversation.chatId === chatId);
|
|
14461
14931
|
return read ? { requestId: read.id } : null;
|
|
14462
14932
|
},
|
|
14463
14933
|
// ── Workspaces guide beacon (the SAME #guide-beacon/#guide-modal, document variant) ──
|