@floless/app 0.156.0 → 0.157.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/cli-actions.mjs +21 -5
- package/dist/floless-server.cjs +70965 -43326
- package/dist/schemas/drawing-check.profile.v1.schema.json +15 -2
- package/dist/schemas/steel.model.v2.schema.json +25 -1
- package/dist/skills/floless-app-actions/SKILL.md +79 -17
- package/dist/skills/floless-app-knowledge/SKILL.md +21 -2
- package/dist/skills/floless-app-new-workflow/SKILL.md +23 -7
- package/dist/skills/floless-app-onboarding/SKILL.md +31 -1
- package/dist/skills/floless-app-report-issue/SKILL.md +3 -3
- package/dist/skills/floless-app-rfi/SKILL.md +40 -6
- package/dist/skills/floless-app-routines/SKILL.md +9 -2
- package/dist/skills/floless-app-steel-model/SKILL.md +1 -1
- package/dist/skills/floless-app-steel-model/references/detail-from-a-screenshot.md +4 -2
- package/dist/skills/floless-app-tweak-contract/SKILL.md +25 -5
- package/dist/skills/floless-app-workflows/SKILL.md +46 -10
- package/dist/skills/floless-app-workflows/references/agent-steps.md +119 -0
- package/dist/web/agent-steps.js +864 -47
- package/dist/web/agents.js +28 -8
- package/dist/web/app.css +478 -3
- package/dist/web/app.js +110 -11
- package/dist/web/aware-update-client.js +1 -0
- package/dist/web/aware.js +685 -170
- package/dist/web/chat-landing-scene.js +372 -0
- package/dist/web/chat.css +245 -1
- package/dist/web/chat.js +2466 -78
- package/dist/web/commands-drawing-check.js +17 -0
- package/dist/web/commands-shell.js +820 -3
- package/dist/web/commands-steel.js +6 -0
- package/dist/web/connections.js +1 -0
- package/dist/web/drawing-check-editor.html +33 -5
- package/dist/web/drawing-check-editor.js +538 -22
- package/dist/web/drawing-check-overlay.js +13 -0
- package/dist/web/flo-avatar.js +28 -3
- package/dist/web/guide.js +7 -2
- package/dist/web/index.html +119 -6
- package/dist/web/instructor.js +3 -3
- package/dist/web/model-view-query.js +12 -2
- package/dist/web/pages.js +865 -34
- package/dist/web/panels.js +5 -2
- package/dist/web/parser-setup-recovery.js +12 -4
- package/dist/web/project-access.js +549 -0
- package/dist/web/report-files.js +50 -0
- package/dist/web/startup-admission.js +132 -0
- package/dist/web/steel-3d-core.js +9 -0
- package/dist/web/steel-editor.html +642 -22
- package/dist/web/steel-model-v2-commands.js +63 -5
- package/dist/web/step-rename.js +287 -0
- package/dist/web/terminal-requests.js +59 -10
- package/dist/web/tool-updates.js +1 -0
- package/dist/web/workspace-root-management.js +39 -0
- package/dist/web/workspaces.js +1667 -63
- package/launch.mjs +9 -7
- package/package.json +3 -1
|
@@ -1408,6 +1408,43 @@ rect.lblhot:focus-visible{outline:2px solid var(--brand);outline-offset:2px;stro
|
|
|
1408
1408
|
#rfiStat b{color:var(--ok)} /* nothing outstanding — the resolved state */
|
|
1409
1409
|
#rfiStat.has b{color:var(--warn)} /* …and "needs review", never an error */
|
|
1410
1410
|
#rfiStat.unknown::after{content:'!';display:inline-grid;place-items:center;width:14px;height:14px;margin-left:4px;border:1px solid color-mix(in srgb,var(--warn) 72%,transparent);border-radius:999px;color:var(--warn);font-size:10px;font-weight:800;line-height:1;background:color-mix(in srgb,var(--warn) 12%,transparent)}
|
|
1411
|
+
/* #2450 — the Raise an RFI dialog wears the RFI list's own rows, chips, notes and forms. */
|
|
1412
|
+
#rfiRaiseModal{position:fixed;inset:0;z-index:20;display:none;align-items:center;justify-content:center}
|
|
1413
|
+
#rfiRaiseModal .mpanel{width:min(640px,92vw)}
|
|
1414
|
+
#rfiRaiseTitle:focus{outline:none}
|
|
1415
|
+
#rfiRaiseTitle:focus-visible{outline:2px solid var(--brand);outline-offset:2px}
|
|
1416
|
+
#rfiRaiseSub{padding:0 14px 10px;color:var(--mut);font-size:11.5px;line-height:1.55}
|
|
1417
|
+
#rfiRaiseBanner{margin:0 14px 10px;padding:7px 9px;border:1px solid var(--warn-edge);border-radius:6px;background:var(--warn-bg);color:var(--warn);font-size:11.5px;line-height:1.5}
|
|
1418
|
+
#rfiRaiseBanner button{margin-left:8px;font-size:11px;padding:2px 8px}
|
|
1419
|
+
#rfiRaiseList{padding:0 8px 12px;overflow:auto;max-height:min(58vh,520px)}
|
|
1420
|
+
#rfiRaiseList .rfirow{display:grid;grid-template-columns:auto minmax(0,1fr);gap:8px;align-items:start;width:100%;padding:9px 8px;font:12px system-ui;color:var(--text)}
|
|
1421
|
+
#rfiRaiseList .rfirow+.rfirow{border-top:1px solid var(--line)}
|
|
1422
|
+
#rfiRaiseList .rfirow:focus-within{outline:2px solid var(--brand);outline-offset:-2px}
|
|
1423
|
+
#rfiRaiseList .rfirow.editing{background:var(--brand-wash);box-shadow:inset 3px 0 0 var(--brand)}
|
|
1424
|
+
#rfiRaiseList .rfirow.editing:focus-within{outline:none}
|
|
1425
|
+
#rfiRaiseList .rfikind{border:1px solid var(--line);color:var(--mut);border-radius:4px;padding:1px 6px;font-size:10px;line-height:1.6;white-space:nowrap;align-self:start}
|
|
1426
|
+
#rfiRaiseList .rfikind.sym{color:var(--warn);border-color:var(--warn-edge);border-style:dashed}
|
|
1427
|
+
#rfiRaiseList .rfikind.needs{color:var(--warn);border-color:var(--warn-edge)}
|
|
1428
|
+
#rfiRaiseList .rfitx{min-width:0;line-height:1.55;white-space:normal;overflow-wrap:anywhere}
|
|
1429
|
+
#rfiRaiseList .rfiraise-toggle{background:transparent;border:0;padding:0;color:var(--text);font:600 12px system-ui;text-align:left;cursor:pointer}
|
|
1430
|
+
#rfiRaiseList .rfiraise-toggle:hover{color:var(--brand)}
|
|
1431
|
+
#rfiRaiseList .rfiraise-q{margin-top:4px}
|
|
1432
|
+
#rfiRaiseList .rfinote{margin-top:4px;color:var(--mut);font-size:11px;line-height:1.5}
|
|
1433
|
+
#rfiRaiseList .rfiacts,#rfiRaiseList .rfirow-acts{margin-top:6px;display:flex;flex-wrap:wrap;gap:5px;align-items:center}
|
|
1434
|
+
#rfiRaiseList .rfiacts button,#rfiRaiseList .rfirow-acts button{font-size:11px;padding:3px 8px}
|
|
1435
|
+
#rfiRaiseList .rfiform{margin-top:6px;display:flex;flex-direction:column;gap:6px}
|
|
1436
|
+
#rfiRaiseList .rfiform label{display:flex;flex-direction:column;gap:3px;font-size:10px;text-transform:uppercase;letter-spacing:.06em;color:var(--mut)}
|
|
1437
|
+
#rfiRaiseList .rfiform input,#rfiRaiseList .rfiform textarea{width:100%;font-size:12px;text-transform:none;letter-spacing:normal}
|
|
1438
|
+
#rfiRaiseList [aria-disabled=true]{opacity:.4;cursor:default}
|
|
1439
|
+
#rfiRaiseList .rfifail{margin:6px 0 0;padding:6px 8px;border:1px solid var(--err-ink);border-radius:6px;background:var(--err-bg);color:var(--err-ink);font-size:11px;line-height:1.5}
|
|
1440
|
+
#rfiRaiseList .rfiunknown{margin:6px 0 0;padding:6px 8px;border:1px solid var(--warn-edge);border-radius:6px;background:var(--warn-bg);color:var(--warn);font-size:11px;line-height:1.5}
|
|
1441
|
+
#rfiRaiseList .rfiaccepted{margin:6px 0 0;padding:6px 8px;border:1px solid var(--ok-edge);border-radius:6px;background:var(--ok-bg);color:var(--ok);font-size:11px;line-height:1.5}
|
|
1442
|
+
#rfiRaiseList .rfiempty{color:var(--mut);font-size:11.5px;line-height:1.6;padding:22px 4px;text-align:center}
|
|
1443
|
+
#rfiRaiseList .rfiempty b{color:var(--text);display:block;font-size:13px;margin-bottom:4px}
|
|
1444
|
+
#rfiRaiseList .rfiempty button{margin-top:8px}
|
|
1445
|
+
#rfiRaiseList .rfiraise-group{margin-top:10px;padding:8px;border-top:1px solid var(--line)}
|
|
1446
|
+
#rfiRaiseList .rfiraise-group .glab{font-size:10px;text-transform:uppercase;letter-spacing:.06em;color:var(--mut)}
|
|
1447
|
+
#rfiRaiseList .rfiraise-group button{margin-top:6px;font-size:11px;padding:3px 8px}
|
|
1411
1448
|
#rfiList .rfirow{display:grid;grid-template-columns:auto minmax(0,1fr);gap:8px;align-items:start;
|
|
1412
1449
|
width:100%;padding:9px 8px;font:12px system-ui;color:var(--text)}
|
|
1413
1450
|
#rfiList .rfirow+.rfirow{border-top:1px solid var(--line)}
|
|
@@ -3280,6 +3317,12 @@ text.mlentx{fill:#e2e8f0;text-anchor:middle;dominant-baseline:central;font-famil
|
|
|
3280
3317
|
STARTED as a copy and has since diverged (#1090 5b-ii): it also matches `textarea`, and it
|
|
3281
3318
|
excludes `[tabindex="-1"]` so the programmatic-focus target a settled action lands on cannot
|
|
3282
3319
|
become the cycle's first or last node. -->
|
|
3320
|
+
<!-- #2450: Raise an RFI about one connection — opened from the readiness card, filed by the person. -->
|
|
3321
|
+
<div id=rfiRaiseModal role=dialog aria-modal=true aria-labelledby=rfiRaiseTitle><div class=mbackdrop id=rfiRaiseBackdrop></div>
|
|
3322
|
+
<div class=mpanel><div class=mhead><b id=rfiRaiseTitle tabindex=-1>Raise an RFI</b><button data-command-id="steel.dialog-close#the Raise an RFI dialog" id=rfiRaiseClose aria-label="Close the Raise an RFI dialog" data-tip="Close">✕</button></div>
|
|
3323
|
+
<div id=rfiRaiseSub>FloLess wrote these questions from the model. You file one by marking it sent or recording its answer; nothing is saved until you file it.</div>
|
|
3324
|
+
<div id=rfiRaiseBanner role=status aria-live=polite aria-atomic=true hidden></div>
|
|
3325
|
+
<div id=rfiRaiseList></div></div></div>
|
|
3283
3326
|
<div id=rfiModal role=dialog aria-modal=true aria-labelledby=rfiTitle><div class=mbackdrop id=rfiBackdrop></div>
|
|
3284
3327
|
<div class=mpanel><div class=mhead><b id=rfiTitle>RFIs</b><button data-command-id="steel.dialog-close#the RFI list" id=rfiClose aria-label="Close the RFI list" data-tip="Close">✕</button></div>
|
|
3285
3328
|
<div id=rfiSub></div>
|
|
@@ -3508,6 +3551,98 @@ const APP_ID = new URLSearchParams(location.search).get('app') || '';
|
|
|
3508
3551
|
const PROJECT = new URLSearchParams(location.search).get('project') || '';
|
|
3509
3552
|
const PROJECT_QS = PROJECT ? ('?project=' + encodeURIComponent(PROJECT)) : '';
|
|
3510
3553
|
|
|
3554
|
+
/**
|
|
3555
|
+
* Requests from outside the editor to show one connection (#2450) — the readiness card's "Open in the
|
|
3556
|
+
* model". Page scope, so the shell can hand one over while this page is still loading.
|
|
3557
|
+
*
|
|
3558
|
+
* ONE SLOT, keyed by the request's id. `window.flolessEditorFocus({jointId, requestId})` answers `false`
|
|
3559
|
+
* for a request with no connection id, and otherwise a promise of how it went: `{ok:true}`,
|
|
3560
|
+
* `{ok:true,fallback,said}` when it landed on the main member instead, `{ok:false,said}`, or
|
|
3561
|
+
* `{superseded:true}` when another request took the slot or this one was withdrawn. The shell reports
|
|
3562
|
+
* that outcome where the person clicked, so it never claims "showing" over a refusal.
|
|
3563
|
+
*
|
|
3564
|
+
* A request replaces whatever holds the slot — held or running. One made before the editor is ready is
|
|
3565
|
+
* held and runs when boot() marks the editor ready. The runner gets `current()`, true only while its
|
|
3566
|
+
* request still holds the slot, and must stop after every await when it turns false.
|
|
3567
|
+
*
|
|
3568
|
+
* `window.flolessEditorFocusCancel(requestId)` withdraws the request with THAT id and nothing else, so a
|
|
3569
|
+
* shell withdrawing an old request can never cancel the one that replaced it.
|
|
3570
|
+
*
|
|
3571
|
+
* There is deliberately NO URL form: the shell checks that this frame's address is exactly the one it
|
|
3572
|
+
* asked for (that is how the Instructor knows the frame is live), so a request carried in the address
|
|
3573
|
+
* and then stripped would unregister the page. The shell calls in instead, as soon as this script has
|
|
3574
|
+
* run.
|
|
3575
|
+
*
|
|
3576
|
+
* `window.flolessEditorState` says which project this frame shows and whether it is ready, so the shell
|
|
3577
|
+
* can tell "this frame is the one" before calling in.
|
|
3578
|
+
*/
|
|
3579
|
+
const EditorFocus = (() => {
|
|
3580
|
+
let slot = null, runner = null, ready = false, failed = '', made = 0;
|
|
3581
|
+
const vacate = (job, outcome) => { if (slot === job) slot = null; job.settle(outcome); };
|
|
3582
|
+
const launch = (job) => {
|
|
3583
|
+
job.running = true;
|
|
3584
|
+
const current = () => slot === job;
|
|
3585
|
+
Promise.resolve().then(() => runner(job.req, current)).then(
|
|
3586
|
+
(outcome) => vacate(job, current() && outcome ? outcome : { superseded: true }),
|
|
3587
|
+
// The runner shows its own sentences; this is only the last line of defence, so the caller is never left waiting.
|
|
3588
|
+
(error) => { console.error('[steel] could not show the connection asked for', error); vacate(job, current() ? { ok: false, said: 'The model could not show connection ' + job.req.jointId + '. Press Open in the model again, or find it in the Model panel.' } : { superseded: true }); });
|
|
3589
|
+
};
|
|
3590
|
+
window.flolessEditorState = { project: PROJECT, ready: false };
|
|
3591
|
+
const text = (value) => typeof value === 'string' && value ? value : '';
|
|
3592
|
+
// #2450: a request may also ask to raise an RFI, and name the check to show first.
|
|
3593
|
+
const normalise = (req) => req && text(req.jointId)
|
|
3594
|
+
? { jointId: req.jointId, ...(req.raiseRfi === true ? { raiseRfi: true } : {}), ...(text(req.checkId) ? { checkId: req.checkId } : {}) }
|
|
3595
|
+
: null;
|
|
3596
|
+
window.flolessEditorFocus = (req) => {
|
|
3597
|
+
if (!normalise(req)) return false;
|
|
3598
|
+
const id = typeof req.requestId === 'string' && req.requestId ? req.requestId : 'editor-' + (++made);
|
|
3599
|
+
let settle = null;
|
|
3600
|
+
const outcome = new Promise((resolve) => { settle = resolve; });
|
|
3601
|
+
const job = { id, req: normalise(req), settle, running: false };
|
|
3602
|
+
// The editor will never be ready (no model, or it failed to load): answer at once, never leave it waiting.
|
|
3603
|
+
if (failed) { settle({ ok: false, said: failed }); return outcome; }
|
|
3604
|
+
const previous = slot;
|
|
3605
|
+
slot = job;
|
|
3606
|
+
// A held request is answered now; a running one learns it at its next await, through current().
|
|
3607
|
+
if (previous && !previous.running) previous.settle({ superseded: true });
|
|
3608
|
+
if (ready && runner) launch(job);
|
|
3609
|
+
return outcome;
|
|
3610
|
+
};
|
|
3611
|
+
window.flolessEditorFocusCancel = (requestId) => {
|
|
3612
|
+
const job = slot;
|
|
3613
|
+
if (!job || job.id !== requestId) return false;
|
|
3614
|
+
slot = null;
|
|
3615
|
+
if (!job.running) job.settle({ superseded: true });
|
|
3616
|
+
return true;
|
|
3617
|
+
};
|
|
3618
|
+
return {
|
|
3619
|
+
/** main() hands over the function that does the work; boot() then marks the editor ready. */
|
|
3620
|
+
setRunner(fn) { runner = fn; },
|
|
3621
|
+
ready() {
|
|
3622
|
+
if (ready || failed) return;
|
|
3623
|
+
if (!runner) {
|
|
3624
|
+
console.error('[steel] the editor became ready without the code that shows a connection');
|
|
3625
|
+
this.fail('The model could not show the connection. Reload the Model step, then press Open in the model again.');
|
|
3626
|
+
return;
|
|
3627
|
+
}
|
|
3628
|
+
ready = true;
|
|
3629
|
+
window.flolessEditorState = { project: PROJECT, ready: true };
|
|
3630
|
+
if (slot && !slot.running) launch(slot);
|
|
3631
|
+
},
|
|
3632
|
+
/**
|
|
3633
|
+
* The editor showed an empty or failed state instead of a model, so it will never be ready. The
|
|
3634
|
+
* request held now, and every later one, is answered with the sentence, never left waiting.
|
|
3635
|
+
*/
|
|
3636
|
+
fail(sentence) {
|
|
3637
|
+
if (ready || failed) return;
|
|
3638
|
+
failed = sentence;
|
|
3639
|
+
window.flolessEditorState = { project: PROJECT, ready: false, failed: true };
|
|
3640
|
+
const job = slot; slot = null;
|
|
3641
|
+
if (job) job.settle({ ok: false, said: failed });
|
|
3642
|
+
},
|
|
3643
|
+
};
|
|
3644
|
+
})();
|
|
3645
|
+
|
|
3511
3646
|
/* Page scope, beside PROJECT, and NOT inside main(): boot() awaits `loadDisplayUnits()` before it
|
|
3512
3647
|
draws, and main() has not run at that point. The first cut put this inside main() and the page died
|
|
3513
3648
|
with `loadDisplayUnits is not defined` — the same class of mistake as reaching the module through a
|
|
@@ -4078,6 +4213,8 @@ let reviewUnavailable = false; // the server could
|
|
|
4078
4213
|
let reviewEventWatermark = null; // a review frame that arrived before the tab was ready
|
|
4079
4214
|
let reviewCycle = null; // the in-flight refresh: { bounds, attempts, late }
|
|
4080
4215
|
function reviewEventMatches(m){return m&&typeof m==='object'&&m.type==='review-changed'&&m.appId===APP_ID&&((m.project||'')===PROJECT);}
|
|
4216
|
+
/* #2449: an assumption on one of this project's connections was recorded or withdrawn. */
|
|
4217
|
+
function assumptionEventMatches(m){return m&&typeof m==='object'&&m.type==='connection-assumptions-changed'&&m.appId===APP_ID&&((m.project||'')===PROJECT);}
|
|
4081
4218
|
function reviewFrameOrderable(m){return Number.isSafeInteger(m.reviewRevision)&&m.reviewRevision>=0;}
|
|
4082
4219
|
function editorHasUnsavedWork(){const sv=document.getElementById('saveStat');return !!sv&&(sv.classList.contains('dirty')||sv.classList.contains('err')||sv.classList.contains('conflict'));}
|
|
4083
4220
|
function parkDraftForExternalChange(){const parked=flushLocalDraft?flushLocalDraft():false;if(!parked)console.warn('steel-editor: pending edits could not be parked before an external model update');return parked;}
|
|
@@ -4211,7 +4348,11 @@ function repaintReviewSurface(){if(window.renderReviewSurface)window.renderRevie
|
|
|
4211
4348
|
there would disable the own-write trigger — the one thing that makes the feature work — for the rest of
|
|
4212
4349
|
the session, with the header stuck on "unavailable" and no user action able to retry. The bounds come
|
|
4213
4350
|
from serverRevision and reviewAt, both valid before any summary lands. */
|
|
4214
|
-
function reviewRefreshForOwnWrite(){
|
|
4351
|
+
function reviewRefreshForOwnWrite(){
|
|
4352
|
+
if(PROJECT&&ReviewClient)markReviewDirty({storeRevision:serverRevision,reviewRevision:reviewAt.reviewRevision});
|
|
4353
|
+
/* #2449: this tab's own save can stop an assumption holding without anyone touching the assumption file, so what the
|
|
4354
|
+
Properties panel says about assumptions is asked again now, not left until the next repaint happens to ask. */
|
|
4355
|
+
if(PROJECT&&window.forgetConnectionAssumptions)window.forgetConnectionAssumptions();}
|
|
4215
4356
|
function handleReviewChanged(m){
|
|
4216
4357
|
if(!reviewEventMatches(m))return;
|
|
4217
4358
|
if(!reviewFrameOrderable(m)){console.warn('steel-editor: ignored an unorderable review event');return;}
|
|
@@ -4276,6 +4417,8 @@ function startContractEvents(){
|
|
|
4276
4417
|
before the tab is ready is DROPPED by the handler's own readiness guard, and boot()'s read of the
|
|
4277
4418
|
same value lands immediately after, so nothing is lost by dropping it. */
|
|
4278
4419
|
if(displayUnitsEventMatches(m)){handleDisplayUnitsChanged(m);return;}
|
|
4420
|
+
// #2449: an assumption was recorded or withdrawn. Forget what the inspector was told and ask again.
|
|
4421
|
+
if(assumptionEventMatches(m)){if(contractEventReady&&window.forgetConnectionAssumptions)window.forgetConnectionAssumptions();return;}
|
|
4279
4422
|
if(reviewEventMatches(m)){if(!contractEventReady){if(reviewFrameOrderable(m)&&(!reviewEventWatermark||m.reviewRevision>=reviewEventWatermark.reviewRevision))reviewEventWatermark=m;}else handleReviewChanged(m);return;}
|
|
4280
4423
|
if(!contractEventMatches(m))return;if(!contractEventReady)bufferContractEvent(m);else handleContractChanged(m);};
|
|
4281
4424
|
source.onerror=()=>{if(source!==contractEventSource)return;contractEventReady=false;if(source.readyState===EventSource.CLOSED){ownWrites.length=0;uncertainWrites.clear();console.warn('steel-editor: SSE channel closed — live updates paused');showAiUpdateBanner('Live updates disconnected — reload to resume change detection.');}};
|
|
@@ -4348,6 +4491,7 @@ const queueWrite = (fn, token) => {
|
|
|
4348
4491
|
* size and colour de-emphasise it just as well.
|
|
4349
4492
|
*/
|
|
4350
4493
|
function showEmpty(icon, headline, bodyText, appIdText, opts) {
|
|
4494
|
+
EditorFocus.fail('The model did not open, so the connection was not shown. The Model step says why.');
|
|
4351
4495
|
const wrap = document.createElement('div');
|
|
4352
4496
|
wrap.style.cssText = 'display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100vh;box-sizing:border-box;text-align:center;color:var(--text);font:13px var(--ui),sans-serif;gap:10px;padding:24px;background:var(--bg)';
|
|
4353
4497
|
wrap.setAttribute('role', 'alert');
|
|
@@ -4742,6 +4886,8 @@ async function boot() {
|
|
|
4742
4886
|
// landing between the snapshot read and the tab becoming ready would sit in reviewEventWatermark
|
|
4743
4887
|
// forever, because SSE is plain fan-out with no replay. The reconnect path already drained both.
|
|
4744
4888
|
drainReviewEvents(contractEventEpoch);
|
|
4889
|
+
// #2450: only now is there a model to show a connection in. A request held while loading runs here.
|
|
4890
|
+
EditorFocus.ready();
|
|
4745
4891
|
}
|
|
4746
4892
|
|
|
4747
4893
|
/**
|
|
@@ -9609,6 +9755,65 @@ function partReviewChipFor(jointId){
|
|
|
9609
9755
|
if(st==='needs-review')return '<div class=row style="margin:2px 0 4px"><span class=chip style="border-color:var(--warn-edge);color:var(--warn)" data-tip="The parent connection is flagged — step back to it to act">Connection needs review</span></div>';
|
|
9610
9756
|
if(st==='unavailable')return '<div class=row style="margin:2px 0 4px"><span class=chip style="border-color:var(--cyan-edge);color:var(--cyan);background:var(--cyan-soft)">Connection review unavailable</span></div>';
|
|
9611
9757
|
return '';}
|
|
9758
|
+
/* #2449: the assumptions a person confirmed on a connection, for the inspector. The readiness answer is the one place
|
|
9759
|
+
that judges whether each still holds (the server compares this connection's whole built result with the state it
|
|
9760
|
+
was confirmed for), so the inspector asks it for the selected connection only, once per model revision, and shows
|
|
9761
|
+
what it said: resting on an assumption, an assumption that no longer applies, or that it could not tell. Never a
|
|
9762
|
+
pass: the check it is about keeps its result, and this label says only what that result rests on. */
|
|
9763
|
+
const assumptionsByJoint=new Map(); // jointId -> { rev, state: 'loading'|'ok'|'unavailable', rows }
|
|
9764
|
+
let assumptionsGen=0;
|
|
9765
|
+
function forgetAssumptions(){assumptionsGen++;assumptionsByJoint.clear();}
|
|
9766
|
+
/* The labels live in their own slots (.asm-slot) and are refreshed IN PLACE when an answer arrives; the Properties panel is
|
|
9767
|
+
never rebuilt for them. Rebuilding it was tried twice and each time took something from the person: a rebuild under a
|
|
9768
|
+
focused field discards the keystrokes, and a rebuild deferred to the field's blur can replace a button between its
|
|
9769
|
+
mousedown and its click (review round 3). A slot touches no control, so neither can happen. */
|
|
9770
|
+
function repaintAssumptionPanel(){
|
|
9771
|
+
for(const slot of document.querySelectorAll('.asm-slot'))slot.innerHTML=assumptionChipInner(slot.getAttribute('data-asm-joint')||'');}
|
|
9772
|
+
async function loadAssumptions(jointId){
|
|
9773
|
+
const gen=assumptionsGen,rev=serverRevision;
|
|
9774
|
+
assumptionsByJoint.set(jointId,{rev,state:'loading',rows:[]});
|
|
9775
|
+
let entry={rev,state:'unavailable',rows:[]};
|
|
9776
|
+
try{
|
|
9777
|
+
const r=await fetch('/api/projects/'+encodeURIComponent(PROJECT)+'/connections/readiness?joint='+encodeURIComponent(jointId));
|
|
9778
|
+
const d=await r.json();
|
|
9779
|
+
if(d&&d.ok===true&&!d.assumptionsUnavailable){
|
|
9780
|
+
const row=Array.isArray(d.rows)?d.rows.find(x=>x&&x.jointId===jointId):null;
|
|
9781
|
+
entry={rev,state:'ok',rows:row&&Array.isArray(row.assumptions)?row.assumptions:[]};
|
|
9782
|
+
}
|
|
9783
|
+
}catch(e){console.warn('steel-editor: could not read the assumptions on '+jointId,e&&e.message?e.message:e);}
|
|
9784
|
+
if(gen!==assumptionsGen)return;
|
|
9785
|
+
entry.at=performance.now();
|
|
9786
|
+
assumptionsByJoint.set(jointId,entry);
|
|
9787
|
+
repaintAssumptionPanel();}
|
|
9788
|
+
/* The live-update transport lives outside main(): it asks again through this when an assumption or the model changes. */
|
|
9789
|
+
window.forgetConnectionAssumptions=()=>{forgetAssumptions();repaintAssumptionPanel();};
|
|
9790
|
+
/* A slot for one connection's label, filled now and refreshed in place later (see repaintAssumptionPanel). */
|
|
9791
|
+
function assumptionChipFor(jointId){
|
|
9792
|
+
return '<div class="asm-slot" data-asm-joint="'+esc(jointId)+'">'+assumptionChipInner(jointId)+'</div>';}
|
|
9793
|
+
function assumptionChipInner(jointId){
|
|
9794
|
+
if(!PROJECT)return '';
|
|
9795
|
+
const e=assumptionsByJoint.get(jointId);
|
|
9796
|
+
// An answer about an older saved model, or an unavailable one older than ten seconds, is asked again.
|
|
9797
|
+
if(!e||e.rev!==serverRevision||(e.state==='unavailable'&&performance.now()-(e.at||0)>10000)){loadAssumptions(jointId);return '';}
|
|
9798
|
+
if(e.state==='loading')return '';
|
|
9799
|
+
if(e.state==='unavailable')return '<div class="row asm-chips" style="margin:0 0 6px"><span class=chip style="border-color:var(--cyan-edge);color:var(--cyan);background:var(--cyan-soft)" data-tip="FloLess could not read the assumptions recorded on this connection this time, so it cannot say whether its checks rest on one. Select the connection again in a moment, or ask in AI Chat to check it">Assumptions unavailable</span></div>';
|
|
9800
|
+
if(!e.rows.length)return '';
|
|
9801
|
+
/* The answer describes the SAVED model. While an edit here is unsaved (or failed to save), it may no longer hold, so no
|
|
9802
|
+
"rests on" claim is made until the save lands and the answer is asked again (Codex review, round 1). */
|
|
9803
|
+
if(editorHasUnsavedWork())return '<div class="row asm-chips" style="margin:0 0 6px"><span class=chip style="border-color:var(--line);color:var(--mut)" data-tip="This connection has assumptions you confirmed. Whether they still hold is checked again once your latest edit is saved">Assumptions checked after saving</span></div>';
|
|
9804
|
+
const holds=e.rows.filter(a=>a&&a.state==='holds'),stale=e.rows.filter(a=>a&&a.state==='stale');
|
|
9805
|
+
const out=[];
|
|
9806
|
+
if(holds.length){
|
|
9807
|
+
const tip=holds.map(a=>'“'+a.statement+'” — about '+a.readingText).join(' · ');
|
|
9808
|
+
out.push('<span class=chip style="border-color:var(--warn-edge);color:var(--warn)" data-tip="'+esc('Checks on this connection rest on what you confirmed, and keep their results: '+tip)+'">Rests on '+(holds.length===1?'an assumption':holds.length+' assumptions')+' you confirmed</span>');
|
|
9809
|
+
}
|
|
9810
|
+
if(stale.length){
|
|
9811
|
+
const why={'connection-changed':'this connection changed after you confirmed it','check-gone':'the check it was about is not on this connection any more','connection-gone':'this connection is not in the model any more'};
|
|
9812
|
+
const reasons=[...new Set(stale.map(a=>why[a.staleReason]||why['connection-changed']))];
|
|
9813
|
+
const one=stale.length===1;
|
|
9814
|
+
out.push('<span class=chip style="border-color:var(--line);color:var(--mut)" data-tip="'+esc((one?'An assumption you confirmed no longer applies: ':'Assumptions you confirmed no longer apply: ')+reasons.join('; ')+'. Ask the AI in AI Chat to propose '+(one?'it':'them')+' again, or withdraw '+(one?'it':'them')+' there.')+'">'+(one?'An assumption':stale.length+' assumptions')+' no longer '+(one?'applies':'apply')+'</span>');
|
|
9815
|
+
}
|
|
9816
|
+
return out.length?'<div class="row asm-chips" style="margin:0 0 6px;gap:6px;flex-wrap:wrap">'+out.join('')+'</div>':'';}
|
|
9612
9817
|
function closeReviewFly(){
|
|
9613
9818
|
const fly=document.getElementById('reviewFly');if(fly)fly.classList.remove('open');
|
|
9614
9819
|
for(const id of ['reviewStat','untrackedStat','regStat']){const b=document.getElementById(id);if(b)b.setAttribute('aria-expanded','false');}
|
|
@@ -11268,6 +11473,7 @@ function panel(){
|
|
|
11268
11473
|
].join('');
|
|
11269
11474
|
p.innerHTML=`<span class=badge>Custom connection</span>
|
|
11270
11475
|
<div class=row style="margin:0 0 6px">${reviewChipFor(j.id)}</div>
|
|
11476
|
+
${assumptionChipFor(j.id)}
|
|
11271
11477
|
<div class="row hint" style="margin:0 0 2px">${onLine}${cs.childIds.length} parts · ${nm}</div>
|
|
11272
11478
|
<div class="row hint" style="margin:0 0 6px;font-size:11px">Read from IFC — opaque tessellated geometry (no per-dimension edit). <b>Esc</b> steps back.</div>
|
|
11273
11479
|
<div class="row f" style="gap:6px;flex-wrap:wrap;margin:0 0 8px">${reviewRow}</div>
|
|
@@ -11297,6 +11503,7 @@ function panel(){
|
|
|
11297
11503
|
else body=sec('Plate')+kv('Size',sz)+kv('Thickness',plate?dim(plate.thickness):dim(pp.plateThickness))+sec('Bolts')+kv('Grid (cols × rows)',esc(`${pp.boltCols||1} × ${pp.boltRows||3}`))+kv('Diameter',pp.boltDia?dim(pp.boltDia):dim(20))+sec('Weld')+kv('Leg',pp.weldLeg?dim(pp.weldLeg):dim(6));
|
|
11298
11504
|
p.innerHTML=`<span class=badge>${connKindLabel(cs.kind)}</span>
|
|
11299
11505
|
<div class=row style="margin:0 0 6px"><span class=chip style="border-color:var(--brand);color:var(--info-ink)">Parametric — editable</span></div>
|
|
11506
|
+
${assumptionChipFor(j.id)}
|
|
11300
11507
|
<div class="row hint" style="margin:0 0 2px">On <button data-command-id="steel.connection-select-member" class=pilllink id=cmpMember data-tip="Select ${esc(j.main)}">${esc(j.main)}</button> · ${cs.childIds.length} parts</div>
|
|
11301
11508
|
<div class="row hint" style="margin:0 0 6px;font-size:11px">Double-click to enter and pick a part · <b>Esc</b> steps back.</div>
|
|
11302
11509
|
${body}
|
|
@@ -11374,6 +11581,7 @@ function panel(){
|
|
|
11374
11581
|
else body=sec(kindName+'')+kv('Width',dim(el&&el.width))+kv('Height',dim(el&&el.depth))+kv('Thickness',dim(el&&el.thickness));
|
|
11375
11582
|
p.innerHTML=`<h3>${esc(head)} <span style="color:var(--mut);font-weight:400">· ${loc}</span></h3>
|
|
11376
11583
|
${partReviewChipFor(j.id)}
|
|
11584
|
+
${assumptionChipFor(j.id)}
|
|
11377
11585
|
<div class="row hint" style="margin-top:2px">Read-only — auto-detailed on <b>${esc(j.main)}</b>; edit its parameters on the member.</div>
|
|
11378
11586
|
${lbl?`<div class="row" style="margin:3px 0 0;font-size:12px;color:var(--brand);font-variant-numeric:tabular-nums">${esc(lbl)}</div>`:''}
|
|
11379
11587
|
${body}
|
|
@@ -11694,7 +11902,8 @@ function panel(){
|
|
|
11694
11902
|
}
|
|
11695
11903
|
if(diag&&diag.severity==='error'){
|
|
11696
11904
|
const truth=connectionRefusalCopy(diag,m);
|
|
11697
|
-
|
|
11905
|
+
// #2449: a connection that is not built has no parts to select, so what rests on an assumption is said here.
|
|
11906
|
+
return `<div class=drow><div style="flex:1 1 100%;min-width:0"><div class="dmsg warn">${esc(truth.head)}</div><div class=hint role=note style="margin-top:3px">${esc(truth.detail)}</div>${joint?assumptionChipFor(joint.id):''}</div></div>`;
|
|
11698
11907
|
}
|
|
11699
11908
|
if(diag&&diag.code==='bolt-gauge-adjusted'){
|
|
11700
11909
|
const authored=fmtDisp(Number(diag.authored)),built=fmtDisp(Number(diag.built));
|
|
@@ -14547,7 +14756,7 @@ addEventListener('keydown',e=>{
|
|
|
14547
14756
|
// This listener is mounted before the shared 3D arbiter. If an editor-owned Escape rung below
|
|
14548
14757
|
// has work to do, stop later listeners now so one keypress cannot also clear a selected clip.
|
|
14549
14758
|
const editorOwnsEscape=e.key==='Escape'&&view3d&&(
|
|
14550
|
-
!!memberEndReview||!!dimEdit||moreOpen()||xfMenuC.isOpen()||labels2dOpen()||lvOpen()||lightboxOpen()||askAiIsOpen()||favModalIsOpen()||detailsOpen()||connLibOpen()||framesOpen()||rfiOpen()||confOpen()||snapMenuOpen()||selFly.classList.contains('open')||
|
|
14759
|
+
!!memberEndReview||!!dimEdit||moreOpen()||xfMenuC.isOpen()||labels2dOpen()||lvOpen()||lightboxOpen()||askAiIsOpen()||favModalIsOpen()||detailsOpen()||connLibOpen()||framesOpen()||rfiOpen()||rfiRaiseOpen()||confOpen()||snapMenuOpen()||selFly.classList.contains('open')||
|
|
14551
14760
|
!!drag||!!gridLinePick||!!gridPick||!!gridMode||!!dimStyleMode||!!cmTool||!!csaxisMode||!!qdPick||!!dimMode||!!selDimIds.size||mode==='add'||
|
|
14552
14761
|
modelEditor.steel.teklaDragging()||modelEditor.steel.refMeasureArmed()||!!geoMode);
|
|
14553
14762
|
if(editorOwnsEscape)e.stopImmediatePropagation();
|
|
@@ -16701,13 +16910,14 @@ function wireTypeFilter(p){
|
|
|
16701
16910
|
p.querySelectorAll('.tfchip').forEach(b=>{
|
|
16702
16911
|
// plain = DROP this type; Alt = ISOLATE it (keep only this type, drop everything else). Three buckets:
|
|
16703
16912
|
// members (by type), dims, grids. Both narrow the real selection, then render() resyncs 2D/3D + re-runs panel().
|
|
16913
|
+
// Publish once: per-member removals repeatedly cloned and announced the whole remaining selection (#2292).
|
|
16704
16914
|
const act=iso=>{const kind=b.dataset.tfkind,key=b.dataset.tfkey,G=gridSelSet();
|
|
16705
16915
|
if(iso){ // keep ONLY this type
|
|
16706
|
-
if(kind==='member'){
|
|
16916
|
+
if(kind==='member'){const drop=new Set(selArr().filter(m=>memberTypeOf(m)!==key).map(m=>m.id));modelSelection.replaceMembers([...selIds].filter(id=>!drop.has(id)));}else modelSelection.clearMembers();
|
|
16707
16917
|
if(kind!=='dim')selDimIds.clear();
|
|
16708
16918
|
if(G&&kind!=='grid')G.clear();
|
|
16709
16919
|
}else{ // drop just this type
|
|
16710
|
-
if(kind==='member'){
|
|
16920
|
+
if(kind==='member'){const drop=new Set(selArr().filter(m=>memberTypeOf(m)===key).map(m=>m.id));modelSelection.replaceMembers([...selIds].filter(id=>!drop.has(id)));}
|
|
16711
16921
|
else if(kind==='dim')selDimIds.clear();
|
|
16712
16922
|
else if(kind==='grid'&&G)G.clear();
|
|
16713
16923
|
}
|
|
@@ -26041,6 +26251,51 @@ function rfiTargetControls(r,occurrenceIndex){
|
|
|
26041
26251
|
return '<button class=ghost data-command-id="steel.rfi-locate-joint#'+esc(key)+'"'+attributes+'>'+esc(label)+'</button>';
|
|
26042
26252
|
}).join('');
|
|
26043
26253
|
}
|
|
26254
|
+
/**
|
|
26255
|
+
* Show the connection a request from outside asked for (#2450; see `EditorFocus`). The 3D view can
|
|
26256
|
+
* still be loading on a fresh open, so it waits for it (bounded) before asking `focusConnection`, which
|
|
26257
|
+
* itself switches to 3D. Every outcome is a sentence; nothing here blocks the editor. The sentence is
|
|
26258
|
+
* shown here, where the person is now looking, and the outcome goes back to the shell for its own line.
|
|
26259
|
+
*/
|
|
26260
|
+
const EDITOR_FOCUS_3D_WAIT_MS=20000;
|
|
26261
|
+
async function runEditorFocus(req,current){
|
|
26262
|
+
const until=Date.now()+EDITOR_FOCUS_3D_WAIT_MS;
|
|
26263
|
+
while(!window.Steel3DView&&Date.now()<until){await new Promise(resolve=>setTimeout(resolve,100));if(!current())return null;}
|
|
26264
|
+
const r=await focusConnection(req.jointId,{current,fallbackToMain:true,
|
|
26265
|
+
beforeSelect:()=>rfiFormFor?'An RFI form is open. Finish or cancel it, then press Open in the model again.':'',
|
|
26266
|
+
beforeFrame:()=>{if(rfiOpen())closeRFI();}});
|
|
26267
|
+
if(!r||!current())return null;
|
|
26268
|
+
// #2450: "Raise an RFI" opens its dialog whether or not the connection could be selected — a hidden or
|
|
26269
|
+
// filtered connection still has questions to answer — except when the connection is gone (there is
|
|
26270
|
+
// nothing to ask about) or an RFI-list form is being typed (it would be lost). `raised` says which.
|
|
26271
|
+
let raise=null;
|
|
26272
|
+
if(req.raiseRfi){
|
|
26273
|
+
const why=r.ok||(r.reason!=='missing'&&r.reason!=='busy')?openRaiseRfi(req.jointId,req.checkId||null):'';
|
|
26274
|
+
raise={raised:r.ok||(r.reason!=='missing'&&r.reason!=='busy')?!why:false,...(why?{raiseSaid:why}:{})};
|
|
26275
|
+
if(why)toast(why,false,9000);
|
|
26276
|
+
}
|
|
26277
|
+
if(!r.ok){
|
|
26278
|
+
const said=r.reason==='missing'?'Connection '+req.jointId+' is no longer in the model. Ask about it again in the chat to get a fresh card.'
|
|
26279
|
+
:r.reason==='view'?r.said+' Switch to the 3D view, then press Open in the model again.'
|
|
26280
|
+
:r.reason==='unbuilt'&&!(raise&&raise.raised)?r.said+' Its row on the readiness card says why; raise an RFI or record an assumption from there.'
|
|
26281
|
+
:r.said;
|
|
26282
|
+
toast(said,false,9000);
|
|
26283
|
+
return {ok:false,reason:r.reason,said,...(raise||{})};
|
|
26284
|
+
}
|
|
26285
|
+
if(r.fallback){toast(r.said,false,9000);return {ok:true,fallback:r.fallback,said:r.said,...(raise||{})};}
|
|
26286
|
+
return {ok:true,...(raise||{})};
|
|
26287
|
+
}
|
|
26288
|
+
// A bug in the runner still ends in a sentence where the person is looking, and the cause in the console.
|
|
26289
|
+
EditorFocus.setRunner(async(req,current)=>{
|
|
26290
|
+
try{return await runEditorFocus(req,current);}
|
|
26291
|
+
catch(error){
|
|
26292
|
+
console.error('[steel] could not show the connection asked for',error);
|
|
26293
|
+
if(!current())return null;
|
|
26294
|
+
const said='The model could not show connection '+req.jointId+'. Press Open in the model again, or find it in the Model panel.';
|
|
26295
|
+
toast(said,false,9000);
|
|
26296
|
+
return {ok:false,said};
|
|
26297
|
+
}
|
|
26298
|
+
});
|
|
26044
26299
|
let rfiTargetGeneration=0,rfiTargetAbort=null,rfiLightboxReturn=null,rfiTargetViewPending=false;
|
|
26045
26300
|
function rfiTargetIdentity(target){return JSON.stringify(target);}
|
|
26046
26301
|
function rfiCancelTarget(){
|
|
@@ -26071,6 +26326,60 @@ function rfiPruneTargetErrors(){
|
|
|
26071
26326
|
||!target||error.targetIdentity!==rfiTargetIdentity(target))rfiTargetErrors.delete(key);
|
|
26072
26327
|
}
|
|
26073
26328
|
}
|
|
26329
|
+
/**
|
|
26330
|
+
* Select one WHOLE connection in 3D and frame it (#2450). The one path for it: an RFI's connection
|
|
26331
|
+
* target and a request from outside the editor (the readiness card's "Open in the model") both come
|
|
26332
|
+
* here, so the two can never select differently.
|
|
26333
|
+
*
|
|
26334
|
+
* Resolves `{ok:true}`, `{ok:false,reason,said}` with `said` a plain sentence, or `null` when
|
|
26335
|
+
* `opts.current()` says a later request superseded this one while the 3D view was coming up.
|
|
26336
|
+
* `reason` is `missing` (no such connection), `busy` (`opts.beforeSelect` said why not), `view` (3D
|
|
26337
|
+
* could not show it), `unbuilt` (FloLess could not build it, so it has no parts to show), `filter` (the
|
|
26338
|
+
* Select filter excludes its parts) or `select` (the selection did not land on exactly this connection —
|
|
26339
|
+
* a stale matching selection never counts): nothing is selected or framed on any of those. `frame`
|
|
26340
|
+
* is the one refusal after selecting: the selection stands, but nothing of it is visible to zoom to.
|
|
26341
|
+
* With `opts.fallbackToMain`, a connection with no built parts selects and frames its main member and
|
|
26342
|
+
* resolves `{ok:true,fallback:'main-member',said}`.
|
|
26343
|
+
*/
|
|
26344
|
+
async function focusConnection(jointId,opts){
|
|
26345
|
+
const o=opts||{},current=o.current||(()=>true);
|
|
26346
|
+
const joint=(C.joints||[]).find(j=>j&&j.id===jointId);
|
|
26347
|
+
if(!joint)return {ok:false,reason:'missing',said:'Connection '+jointId+' is no longer in the model.'};
|
|
26348
|
+
if(o.viewPending)o.viewPending(true);
|
|
26349
|
+
let ready=false;
|
|
26350
|
+
try{ready=await requestView3d();}finally{if(o.viewPending)o.viewPending(false);}
|
|
26351
|
+
if(!current())return null;
|
|
26352
|
+
const busy=o.beforeSelect?o.beforeSelect():'';
|
|
26353
|
+
if(busy)return {ok:false,reason:'busy',said:busy};
|
|
26354
|
+
const parts=connChildIdsEditor(jointId);
|
|
26355
|
+
// A connection that was never built has no parts to select. When the caller allows it, land on the
|
|
26356
|
+
// steel it is about instead — its main member — and say so, rather than leaving the person to hunt.
|
|
26357
|
+
const main=typeof joint.main==='string'?joint.main:'';
|
|
26358
|
+
if(ready&&window.Steel3DView&&!parts.length&&o.fallbackToMain&&main){
|
|
26359
|
+
if(!selIdOK(main))return {ok:false,reason:'filter',said:'FloLess could not build connection '+jointId+', and its main member '+main+' is excluded by the selection filter. Turn on that member type under Select, then try again.'};
|
|
26360
|
+
// The editor's own "go to the main member" sequence (cmpMember): leave any whole-connection selection
|
|
26361
|
+
// first, or its envelope, breadcrumb and inspector stay on the connection picked before.
|
|
26362
|
+
if(modelEditor.isReady()&&modelEditor.steel.clearConnSel)modelEditor.steel.clearConnSel();
|
|
26363
|
+
modelSelection.replaceMembers([main]);selDimIds.clear();sel3dDimIds.clear();modelSelection.clearGrids();render();
|
|
26364
|
+
if(!selIds.has(main))return {ok:false,reason:'select',said:'FloLess could not build connection '+jointId+', and the 3D view could not select its main member '+main+'.'};
|
|
26365
|
+
if(o.beforeFrame)o.beforeFrame();
|
|
26366
|
+
// The view answers false when nothing selected is visible to zoom to (hidden, or isolated away).
|
|
26367
|
+
if(modelEditor.dispatch('model.fit-selection')===false)return {ok:false,reason:'frame',said:'FloLess could not build connection '+jointId+', so its main member '+main+' is selected, but it is hidden in the 3D view. Use Show all in the Visibility menu, then press Open in the model again.'};
|
|
26368
|
+
// The builder's own rule (connection-readiness.ts): a recipe sits at end 2 only for `end1`; an imported
|
|
26369
|
+
// connection has an end only when it names one.
|
|
26370
|
+
const end=joint.at==='end1'?' (end 2)':joint.at==='base'?' (base)':joint.at==='end0'||joint.kind!=='custom'?' (end 1)':'';
|
|
26371
|
+
return {ok:true,fallback:'main-member',said:'FloLess could not build connection '+jointId+', so its main member '+main+end+' is selected instead.'};
|
|
26372
|
+
}
|
|
26373
|
+
if(!ready||!window.Steel3DView)return {ok:false,reason:'view',said:'The 3D view could not show connection '+jointId+'.'};
|
|
26374
|
+
if(!parts.length)return {ok:false,reason:'unbuilt',said:'FloLess could not build connection '+jointId+', so the model has nothing of it to show.'};
|
|
26375
|
+
if(!parts.every(selIdOK))return {ok:false,reason:'filter',said:'Connection '+jointId+' is excluded by the selection filter. Turn on '+(joint.kind||'its type')+' connections under Select, then try again.'};
|
|
26376
|
+
const selectedThisAttempt=treeSelectConn(jointId,{});
|
|
26377
|
+
const selected=connSelInfo();
|
|
26378
|
+
if(!selectedThisAttempt||!selected||selected.conn!==jointId||!selected.whole)return {ok:false,reason:'select',said:'The 3D view could not select connection '+jointId+'.'};
|
|
26379
|
+
if(o.beforeFrame)o.beforeFrame();
|
|
26380
|
+
if(modelEditor.dispatch('model.fit-selection')===false)return {ok:false,reason:'frame',said:'Connection '+jointId+' is selected, but it is hidden in the 3D view. Use Show all in the Visibility menu, then press Open in the model again.'};
|
|
26381
|
+
return {ok:true};
|
|
26382
|
+
}
|
|
26074
26383
|
async function rfiOpenTarget(button){
|
|
26075
26384
|
const tuple=JSON.parse(button.dataset.rfiTarget),held=rfiCurrentTarget(tuple);
|
|
26076
26385
|
const localErrorKey=Number.isSafeInteger(tuple[3])?rfiOccurrenceKey(tuple[0],tuple[3]):null;
|
|
@@ -26087,24 +26396,23 @@ async function rfiOpenTarget(button){
|
|
|
26087
26396
|
if(localErrorKey)rfiTargetErrors.delete(localErrorKey);
|
|
26088
26397
|
rfiLocate(t.memberId);return;
|
|
26089
26398
|
}
|
|
26090
|
-
const
|
|
26091
|
-
|
|
26092
|
-
|
|
26093
|
-
|
|
26094
|
-
if(!
|
|
26095
|
-
|
|
26096
|
-
|
|
26097
|
-
if(!
|
|
26098
|
-
|
|
26099
|
-
|
|
26100
|
-
|
|
26101
|
-
|
|
26102
|
-
|
|
26103
|
-
|
|
26104
|
-
fail('The 3D view could not select this exact connection. The RFI is still open.');return;
|
|
26399
|
+
const focused=await focusConnection(t.jointId,{current,
|
|
26400
|
+
viewPending:on=>{if(on)rfiTargetViewPending=true;else if(generation===rfiTargetGeneration)rfiTargetViewPending=false;},
|
|
26401
|
+
beforeSelect:()=>rfiFormFor?'Finish or cancel the open RFI form before locating a connection.':'',
|
|
26402
|
+
beforeFrame:closeRFI});
|
|
26403
|
+
if(!focused)return;
|
|
26404
|
+
// A frame that found nothing visible happens after the list closed for it: say it where the person now is.
|
|
26405
|
+
if(!focused.ok&&focused.reason==='frame'){if(localErrorKey)rfiTargetErrors.delete(localErrorKey);toast('This connection is selected, but it is hidden in the 3D view. Use Show all in the Visibility menu to see it. The RFI is still open.',false,9000);return;}
|
|
26406
|
+
if(!focused.ok){
|
|
26407
|
+
fail(focused.reason==='missing'?'This connection is no longer in the model.'
|
|
26408
|
+
:focused.reason==='busy'?focused.said
|
|
26409
|
+
:focused.reason==='filter'?focused.said+' The RFI is still open.'
|
|
26410
|
+
:focused.reason==='view'||focused.reason==='unbuilt'?'The 3D view could not show this connection. The RFI is still open.'
|
|
26411
|
+
:'The 3D view could not select this exact connection. The RFI is still open.');
|
|
26412
|
+
return;
|
|
26105
26413
|
}
|
|
26106
26414
|
if(localErrorKey)rfiTargetErrors.delete(localErrorKey);
|
|
26107
|
-
|
|
26415
|
+
return;
|
|
26108
26416
|
}
|
|
26109
26417
|
rfiTargetAbort=new AbortController();
|
|
26110
26418
|
const url=held.liveGap
|
|
@@ -26808,6 +27116,318 @@ async function openActiveProvisional(memberId,openSource,invoker){
|
|
|
26808
27116
|
}
|
|
26809
27117
|
|
|
26810
27118
|
let rfiDialogReturn=null;
|
|
27119
|
+
/* ── #2450: Raise an RFI about one connection ─────────────────────────────────────────────────────────
|
|
27120
|
+
* The readiness card's "Raise an RFI" lands here, after the connection is selected and framed. The
|
|
27121
|
+
* questions are FloLess's (GET …/connections/:jointId/rfi-questions): the same question a drawing read
|
|
27122
|
+
* raises, worded for what is actually known. The person reviews one and files it — by marking it sent
|
|
27123
|
+
* or recording the answer, never as a bare draft (the promote route's atomic rule). The AI may propose a
|
|
27124
|
+
* filing in the chat (rfis.file-connection-*), but only as a card the person confirms; it never files alone.
|
|
27125
|
+
*
|
|
27126
|
+
* What is filed is what was reviewed: the filing repeats the question's digest, and the server refuses
|
|
27127
|
+
* a question that changed. Edits not yet saved are saved first, so the questions are about the model
|
|
27128
|
+
* the person sees; if they cannot be saved, the person is told and may go on with the saved model's
|
|
27129
|
+
* questions, labelled as such. A filing whose answer never arrived keeps its exact request and
|
|
27130
|
+
* one-time key, so trying again can never file it twice.
|
|
27131
|
+
* ───────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
27132
|
+
const RFI_RAISE_DEADLINE_MS=60000;
|
|
27133
|
+
let rfiRaise=null,rfiRaiseSeq=0,rfiRaiseReturn=null;
|
|
27134
|
+
/**
|
|
27135
|
+
* Attempts whose answer never came back, by connection and check. They outlive the dialog: closing it,
|
|
27136
|
+
* or raising an RFI about another connection, must never drop the exact request and one-time key that
|
|
27137
|
+
* may already have filed something. Removed only when an answer settles the attempt, or when the person
|
|
27138
|
+
* discards it (which reads the questions again, so anything it did file shows).
|
|
27139
|
+
*/
|
|
27140
|
+
const rfiRaiseUnsettled=new Map();
|
|
27141
|
+
const rfiRaiseKey=(jointId,checkId)=>jointId+'\u0000'+checkId;
|
|
27142
|
+
const RFI_RAISE_UNSETTLED_TEXT='FloLess could not confirm whether this was filed. Press the same button again \u2014 the same attempt is never filed twice.';
|
|
27143
|
+
function rfiRaiseOpen(){return document.getElementById('rfiRaiseModal').style.display==='flex';}
|
|
27144
|
+
function rfiRaiseEl(tag,props,text){const n=document.createElement(tag);if(props)for(const[k,v]of Object.entries(props)){if(v==null||v===false)continue;if(k==='dataset')Object.assign(n.dataset,v);else if(k.startsWith('on'))n[k]=v;else n.setAttribute(k,v===true?'':String(v));}if(text!=null)n.textContent=text;return n;}
|
|
27145
|
+
const rfiRaiseCap=s=>{const t=String(s||'');return t?t[0].toUpperCase()+t.slice(1)+(/[.!?]$/.test(t)?'':'.'):t;};
|
|
27146
|
+
/** Open the dialog for one connection; `checkId` (a readiness row's check) comes first and open. */
|
|
27147
|
+
function openRaiseRfi(jointId,checkId,invoker){
|
|
27148
|
+
if(!PROJECT)return 'This model is not part of a project, so an RFI cannot be raised from it.';
|
|
27149
|
+
// A filing still out keeps the dialog: replacing it would drop that filing's answer unsaid.
|
|
27150
|
+
if(rfiRaise&&rfiRaise.busy)return 'An RFI about connection '+rfiRaise.jointId+' is still being filed. Wait for it, then press Raise an RFI again.';
|
|
27151
|
+
// A form being typed in the RFI list is never closed under the person.
|
|
27152
|
+
if(rfiFormFor)return 'An RFI form is open in the RFI list. Finish or cancel it, then press Raise an RFI again.';
|
|
27153
|
+
if(rfiOpen())closeRFI();
|
|
27154
|
+
rfiRaiseReturn=invoker&&invoker.isConnected?invoker:(document.activeElement instanceof Element?document.activeElement:null);
|
|
27155
|
+
rfiRaise={jointId,checkId:checkId||null,status:'loading',data:null,error:'',useSaved:false,expanded:null,forms:new Map(),outcomes:new Map(),busy:null,generation:-1,seq:++rfiRaiseSeq};
|
|
27156
|
+
// Bring back every attempt on this connection that is still waiting to be settled, as it was left.
|
|
27157
|
+
for(const[key,attempt]of rfiRaiseUnsettled){
|
|
27158
|
+
if(attempt.jointId!==jointId)continue;
|
|
27159
|
+
rfiRaise.forms.set(attempt.checkId,attempt.form);
|
|
27160
|
+
rfiRaise.outcomes.set(attempt.checkId,{kind:'unknown',text:attempt.text||RFI_RAISE_UNSETTLED_TEXT});
|
|
27161
|
+
if(!rfiRaise.checkId)rfiRaise.checkId=attempt.checkId;
|
|
27162
|
+
}
|
|
27163
|
+
document.getElementById('rfiRaiseTitle').textContent='Raise an RFI about connection '+jointId;
|
|
27164
|
+
document.getElementById('rfiRaiseModal').style.display='flex';
|
|
27165
|
+
renderRaiseRfi();
|
|
27166
|
+
document.getElementById('rfiRaiseTitle').focus();
|
|
27167
|
+
raiseRfiLoad();
|
|
27168
|
+
return '';
|
|
27169
|
+
}
|
|
27170
|
+
function closeRaiseRfi(){
|
|
27171
|
+
if(!rfiRaise)return;
|
|
27172
|
+
if(rfiRaise.busy)return; // a filing is out: its answer must land somewhere the person can read it
|
|
27173
|
+
rfiRaise=null;rfiRaiseSeq++;
|
|
27174
|
+
document.getElementById('rfiRaiseModal').style.display='none';
|
|
27175
|
+
const back=rfiRaiseReturn&&rfiRaiseReturn.isConnected?rfiRaiseReturn:null;rfiRaiseReturn=null;if(back)back.focus();
|
|
27176
|
+
}
|
|
27177
|
+
/** Edits not yet saved are saved first. '' when the saved model is what the person sees, else why not. */
|
|
27178
|
+
const RFI_RAISE_SAVE_MS=30000;
|
|
27179
|
+
async function raiseRfiSaved(){
|
|
27180
|
+
let state=contractSaveState();
|
|
27181
|
+
if(state==='dirty'||state==='saving'){
|
|
27182
|
+
let timer=null;
|
|
27183
|
+
const late=new Promise(resolve=>{timer=setTimeout(()=>resolve('late'),RFI_RAISE_SAVE_MS);});
|
|
27184
|
+
try{if(await Promise.race([window.flushContract().then(()=>'saved'),late])==='late')return 'Your latest edits are taking too long to save, so these questions would be about the saved model, not what you see.';}
|
|
27185
|
+
catch(e){console.error('[steel] saving edits before raising an RFI failed',e);}
|
|
27186
|
+
finally{clearTimeout(timer);}
|
|
27187
|
+
state=contractSaveState();
|
|
27188
|
+
}
|
|
27189
|
+
if(state==='clean')return '';
|
|
27190
|
+
return state==='conflict'
|
|
27191
|
+
?'Your latest edits clash with a newer saved model, so they are not saved. These questions would be about the saved model, not what you see.'
|
|
27192
|
+
:'Your latest edits could not be saved, so these questions would be about the saved model, not what you see.';
|
|
27193
|
+
}
|
|
27194
|
+
async function raiseRfiLoad(keepMessage){
|
|
27195
|
+
const r=rfiRaise;if(!r)return;const seq=r.seq;
|
|
27196
|
+
r.status='loading';if(!keepMessage)r.error='';renderRaiseRfi();
|
|
27197
|
+
const unsaved=await raiseRfiSaved();
|
|
27198
|
+
if(rfiRaise!==r||r.seq!==seq)return;
|
|
27199
|
+
if(unsaved&&!r.useSaved){r.status='unsaved';r.error=unsaved;renderRaiseRfi();return;}
|
|
27200
|
+
r.generation=modelEditGeneration;
|
|
27201
|
+
const ctl=new AbortController(),timer=setTimeout(()=>ctl.abort(),RFI_RAISE_DEADLINE_MS);
|
|
27202
|
+
let res=null,body=null;
|
|
27203
|
+
try{res=await fetch('/api/projects/'+encodeURIComponent(PROJECT)+'/connections/'+encodeURIComponent(r.jointId)+'/rfi-questions',{signal:ctl.signal});body=await res.json().catch(()=>null);}
|
|
27204
|
+
catch(e){console.error('[steel] the RFI questions for a connection could not be read',e);}
|
|
27205
|
+
finally{clearTimeout(timer);}
|
|
27206
|
+
if(rfiRaise!==r||r.seq!==seq)return;
|
|
27207
|
+
if(!res||!res.ok||!body||body.ok!==true){
|
|
27208
|
+
r.status='failed';
|
|
27209
|
+
r.error=body&&typeof body.error==='string'&&body.error?rfiRaiseCap(body.error):'FloLess could not read the questions for connection '+r.jointId+' just now. Try again in a moment.';
|
|
27210
|
+
renderRaiseRfi();return;
|
|
27211
|
+
}
|
|
27212
|
+
r.data=body;r.status='ready';
|
|
27213
|
+
const qs=body.questions||[];
|
|
27214
|
+
// A kept attempt whose question an RFI now holds is settled: there is nothing left to file, and both its
|
|
27215
|
+
// retry and its discard would be hidden behind that RFI. The RFI may be the one this attempt filed (its
|
|
27216
|
+
// answer was the one lost) or one filed elsewhere meanwhile, so the sentence names it and says where to
|
|
27217
|
+
// look, never claims whose words it carries.
|
|
27218
|
+
for(const q of qs){
|
|
27219
|
+
if(!q.live)continue;
|
|
27220
|
+
const key=rfiRaiseKey(r.jointId,q.checkId);
|
|
27221
|
+
if(!rfiRaiseUnsettled.has(key))continue;
|
|
27222
|
+
rfiRaiseUnsettled.delete(key);r.forms.delete(q.checkId);
|
|
27223
|
+
r.outcomes.set(q.checkId,{kind:'filed',rfiId:q.live.rfiId,text:'This question is now held by '+q.live.rfiId+' ('+q.live.status+'), so the attempt FloLess could not confirm is settled. Open '+q.live.rfiId+' to see what it records.'});
|
|
27224
|
+
}
|
|
27225
|
+
if(!r.expanded||!qs.some(q=>q.checkId===r.expanded))r.expanded=(r.checkId&&qs.some(q=>q.checkId===r.checkId))?r.checkId:(qs.length===1?qs[0].checkId:null);
|
|
27226
|
+
renderRaiseRfi();
|
|
27227
|
+
}
|
|
27228
|
+
function raiseRfiOrdered(){
|
|
27229
|
+
const qs=[...((rfiRaise&&rfiRaise.data&&rfiRaise.data.questions)||[])];
|
|
27230
|
+
const first=rfiRaise&&rfiRaise.checkId;
|
|
27231
|
+
return first?[...qs.filter(q=>q.checkId===first),...qs.filter(q=>q.checkId!==first)]:qs;
|
|
27232
|
+
}
|
|
27233
|
+
function raiseRfiTargets(q){
|
|
27234
|
+
const parts=[];
|
|
27235
|
+
for(const t of q.targets||[]){
|
|
27236
|
+
if(t.where==='model'&&t.jointId)parts.push('Connection '+t.jointId);
|
|
27237
|
+
else if(t.where==='model'&&t.memberId)parts.push('Member '+t.memberId+(t.end===undefined?'':' (end '+(t.end+1)+')'));
|
|
27238
|
+
else if(t.where==='drawing')parts.push((t.sheet||('page '+t.page))+(t.mark?' '+t.mark:'')+(t.role==='detail'?' (detail)':''));
|
|
27239
|
+
}
|
|
27240
|
+
return parts.join(' · ');
|
|
27241
|
+
}
|
|
27242
|
+
function renderRaiseRfi(){
|
|
27243
|
+
const r=rfiRaise,list=document.getElementById('rfiRaiseList'),banner=document.getElementById('rfiRaiseBanner');
|
|
27244
|
+
if(!list)return;
|
|
27245
|
+
const focusKey=document.activeElement&&list.contains(document.activeElement)?document.activeElement.dataset.raiseCtl:null;
|
|
27246
|
+
list.replaceChildren();banner.hidden=true;banner.replaceChildren();
|
|
27247
|
+
document.getElementById('rfiRaiseModal').toggleAttribute('aria-busy',!!(r&&r.busy));
|
|
27248
|
+
if(!r)return;
|
|
27249
|
+
if(r.status==='loading'){list.append(rfiRaiseEl('div',{class:'rfiempty'},'Reading this connection’s questions…'));return;}
|
|
27250
|
+
if(r.status==='unsaved'){
|
|
27251
|
+
banner.hidden=false;banner.append(document.createTextNode(r.error+' '),
|
|
27252
|
+
rfiRaiseEl('button',{type:'button','data-command-id':'steel.rfi-raise-use-saved#connection '+r.jointId,'data-command-instance-label':'connection '+r.jointId,'data-raise-ctl':'use-saved',onclick:()=>{r.useSaved=true;raiseRfiLoad();}},'Show the saved model’s questions'));
|
|
27253
|
+
list.append(rfiRaiseEl('div',{class:'rfiempty'},'Save your edits, or go on with the saved model.'));return;
|
|
27254
|
+
}
|
|
27255
|
+
if(r.status==='failed'){
|
|
27256
|
+
const box=rfiRaiseEl('div',{class:'rfiempty'});
|
|
27257
|
+
box.append(rfiRaiseEl('b',null,'The questions for connection '+r.jointId+' could not be read.'),document.createTextNode(r.error),rfiRaiseEl('br'),
|
|
27258
|
+
rfiRaiseEl('button',{type:'button','data-command-id':'steel.rfi-raise-retry#connection '+r.jointId,'data-command-instance-label':'connection '+r.jointId,'data-raise-ctl':'retry',onclick:()=>raiseRfiLoad()},'Try again'));
|
|
27259
|
+
list.append(box);return;
|
|
27260
|
+
}
|
|
27261
|
+
const notes=[];
|
|
27262
|
+
if(r.useSaved)notes.push('These questions are about the saved model, not your unsaved edits.');
|
|
27263
|
+
if(r.data&&r.data.rfisUnavailable)notes.push(r.data.rfisUnavailable);
|
|
27264
|
+
if(notes.length){banner.hidden=false;banner.textContent=notes.join(' ');}
|
|
27265
|
+
const storeBlind=!!(r.data&&r.data.rfisUnavailable);
|
|
27266
|
+
if(r.error){const e=rfiRaiseEl('div',{class:'rfifail',role:'alert'},r.error);list.append(e);}
|
|
27267
|
+
const qs=raiseRfiOrdered();
|
|
27268
|
+
if(!qs.length){
|
|
27269
|
+
const box=rfiRaiseEl('div',{class:'rfiempty'});
|
|
27270
|
+
box.append(rfiRaiseEl('b',null,'Nothing to raise an RFI about on connection '+r.jointId+'.'),document.createTextNode('Nothing on it is outside a limit, unmeasured or failing to build.'));
|
|
27271
|
+
list.append(box);
|
|
27272
|
+
}
|
|
27273
|
+
for(const q of qs){
|
|
27274
|
+
const open=r.expanded===q.checkId,form=r.forms.get(q.checkId),outcome=r.outcomes.get(q.checkId),busy=r.busy===q.checkId;
|
|
27275
|
+
const label=q.label+' · connection '+r.jointId;
|
|
27276
|
+
const row=rfiRaiseEl('div',{class:'rfirow'+(form?' editing':''),'data-raise-check':q.checkId});
|
|
27277
|
+
const chip=q.live?rfiRaiseEl('span',{class:'rfikind needs'},q.live.rfiId+' \u00b7 '+q.live.status)
|
|
27278
|
+
:storeBlind?rfiRaiseEl('span',{class:'rfikind'},'Cannot tell'):rfiRaiseEl('span',{class:'rfikind sym'},'Not filed');
|
|
27279
|
+
const body=rfiRaiseEl('div',{class:'rfitx'});
|
|
27280
|
+
body.append(rfiRaiseEl('button',{type:'button',class:'rfiraise-toggle','aria-expanded':open?'true':'false','data-command-id':'steel.rfi-raise-question#'+label,'data-command-instance-label':label,'data-raise-ctl':'toggle:'+q.checkId,'aria-disabled':r.busy?'true':null,
|
|
27281
|
+
onclick:()=>{if(r.busy)return;r.expanded=open?null:q.checkId;renderRaiseRfi();}},(open?'Hide — ':'')+q.label));
|
|
27282
|
+
if(open){
|
|
27283
|
+
body.append(rfiRaiseEl('div',{class:'rfiraise-q'},q.question));
|
|
27284
|
+
const about=raiseRfiTargets(q);
|
|
27285
|
+
if(about)body.append(rfiRaiseEl('div',{class:'rfinote'},'About: '+about));
|
|
27286
|
+
if(outcome)body.append(rfiRaiseEl('div',{class:outcome.kind==='filed'?'rfiaccepted':outcome.kind==='unknown'?'rfiunknown':'rfifail',role:outcome.kind==='filed'?'status':'alert'},outcome.text));
|
|
27287
|
+
const acts=rfiRaiseEl('div',{class:'rfiacts'});
|
|
27288
|
+
const live=q.live||(outcome&&outcome.kind==='filed'&&outcome.rfiId?{rfiId:outcome.rfiId}:null);
|
|
27289
|
+
if(live){
|
|
27290
|
+
acts.append(rfiRaiseEl('button',{type:'button','data-command-id':'steel.rfi-raise-open-record#'+live.rfiId,'data-command-instance-label':live.rfiId,'data-raise-ctl':'open:'+q.checkId,
|
|
27291
|
+
onclick:()=>{const id=live.rfiId;closeRaiseRfi();openRFI(null,null,id);}},'Open '+live.rfiId));
|
|
27292
|
+
body.append(acts);
|
|
27293
|
+
}else if(form){
|
|
27294
|
+
body.append(raiseRfiForm(q,form,busy,label));
|
|
27295
|
+
}else if(storeBlind){
|
|
27296
|
+
// Filing needs to know whether an RFI already holds this question; the banner says why it cannot.
|
|
27297
|
+
acts.append(rfiRaiseEl('button',{type:'button','data-command-id':'steel.rfi-raise-retry#connection '+r.jointId,'data-command-instance-label':'connection '+r.jointId,'data-raise-ctl':'retry-store:'+q.checkId,
|
|
27298
|
+
onclick:()=>raiseRfiLoad()},'Check again'));
|
|
27299
|
+
body.append(acts);
|
|
27300
|
+
}else{
|
|
27301
|
+
acts.append(rfiRaiseEl('button',{type:'button','data-command-id':'steel.rfi-send#'+label,'data-command-instance-label':label,'aria-label':'Mark sent: '+label,'data-raise-ctl':'send:'+q.checkId,'aria-disabled':r.busy?'true':null,
|
|
27302
|
+
onclick:()=>{if(r.busy)return;r.forms.set(q.checkId,{action:'send',value:'',opKey:null,request:null});renderRaiseRfi();focusRaise('field:'+q.checkId);}},'Mark sent…'),
|
|
27303
|
+
rfiRaiseEl('button',{type:'button','data-command-id':'steel.rfi-answer#'+label,'data-command-instance-label':label,'aria-label':'Record the answer: '+label,'data-raise-ctl':'answer:'+q.checkId,'aria-disabled':r.busy?'true':null,
|
|
27304
|
+
onclick:()=>{if(r.busy)return;r.forms.set(q.checkId,{action:'answer',value:'',opKey:null,request:null});renderRaiseRfi();focusRaise('field:'+q.checkId);}},'Record answer…'));
|
|
27305
|
+
body.append(acts);
|
|
27306
|
+
}
|
|
27307
|
+
}
|
|
27308
|
+
row.append(chip,body);list.append(row);
|
|
27309
|
+
}
|
|
27310
|
+
const groups=[['Handled elsewhere',(r.data&&r.data.routed||[]).map(x=>x.text)],['Worth knowing',r.data&&r.data.notRaisable||[]]];
|
|
27311
|
+
for(const[title,items]of groups){
|
|
27312
|
+
if(!items.length)continue;
|
|
27313
|
+
const g=rfiRaiseEl('div',{class:'rfiraise-group'});g.append(rfiRaiseEl('div',{class:'glab'},title));
|
|
27314
|
+
for(const t of items)g.append(rfiRaiseEl('div',{class:'rfinote'},t));
|
|
27315
|
+
if(title==='Handled elsewhere')g.append(rfiRaiseEl('button',{type:'button','data-command-id':'steel.rfi-raise-open-list#connection '+r.jointId,'data-command-instance-label':'connection '+r.jointId,'data-raise-ctl':'rfi-list',onclick:()=>{closeRaiseRfi();openRFI();}},'Open the RFI list'));
|
|
27316
|
+
list.append(g);
|
|
27317
|
+
}
|
|
27318
|
+
if(focusKey)focusRaise(focusKey);
|
|
27319
|
+
}
|
|
27320
|
+
function raiseRfiForm(q,form,busy,label){
|
|
27321
|
+
const box=rfiRaiseEl('div',{class:'rfiform',role:'group','aria-label':(form.action==='send'?'Mark sent: ':'Record the answer: ')+label});
|
|
27322
|
+
if(busy)box.setAttribute('aria-busy','true');
|
|
27323
|
+
const field=form.action==='send'
|
|
27324
|
+
?rfiRaiseEl('input',{type:'text','data-command-id':'steel.rfi-field-to#'+label,'data-command-instance-label':label,'aria-label':'To, for '+label,placeholder:'Who you sent it to','data-raise-ctl':'field:'+q.checkId,'aria-disabled':busy?'true':null})
|
|
27325
|
+
:rfiRaiseEl('textarea',{rows:3,'data-command-id':'steel.rfi-field-text#'+label,'data-command-instance-label':label,'aria-label':'What came back, for '+label,placeholder:'The answer, as the engineer gave it','data-raise-ctl':'field:'+q.checkId,'aria-disabled':busy?'true':null});
|
|
27326
|
+
field.value=form.value;
|
|
27327
|
+
const uncertain=!!form.request;
|
|
27328
|
+
if(uncertain)field.setAttribute('readonly','');
|
|
27329
|
+
field.oninput=()=>{if(busy||uncertain){field.value=form.value;return;}form.value=field.value;form.opKey=null;form.request=null;const s=box.querySelector('[data-raise-ctl^="submit:"]');const ok=!!field.value.trim();if(s)s.setAttribute('aria-disabled',ok?'false':'true');
|
|
27330
|
+
// The hint follows what is typed, so it never asks for an answer that is already there.
|
|
27331
|
+
const h=box.querySelector('.rfinote');if(h)h.textContent=ok?'Nothing is saved until you file it.':(form.action==='send'?'Enter who it was sent to, then file it.':'Enter what came back, then file it.');};
|
|
27332
|
+
const lab=rfiRaiseEl('label');lab.append(document.createTextNode(form.action==='send'?'To':'What came back'),field);
|
|
27333
|
+
const ok=!!form.value.trim()&&!busy;
|
|
27334
|
+
const acts=rfiRaiseEl('div',{class:'rfirow-acts'});
|
|
27335
|
+
acts.append(rfiRaiseEl('button',{type:'button','data-command-id':'steel.rfi-submit#'+label,'data-command-instance-label':label,'data-raise-ctl':'submit:'+q.checkId,'aria-disabled':ok?'false':'true',
|
|
27336
|
+
onclick:()=>{if(!busy&&form.value.trim())raiseRfiFile(q.checkId);else if(!busy)focusRaise('field:'+q.checkId);}},busy?'Filing…':form.action==='send'?'File and mark sent':'File with answer'),
|
|
27337
|
+
rfiRaiseEl('button',{type:'button',class:'ghost','data-command-id':'steel.rfi-cancel#'+label,'data-command-instance-label':label,'data-raise-ctl':'cancel:'+q.checkId,'aria-disabled':busy?'true':null,
|
|
27338
|
+
onclick:()=>{if(busy)return;rfiRaise.forms.delete(q.checkId);rfiRaise.outcomes.delete(q.checkId);rfiRaiseUnsettled.delete(rfiRaiseKey(rfiRaise.jointId,q.checkId));
|
|
27339
|
+
// Discarding an attempt whose answer never came: read again, so an RFI it DID file shows as filed.
|
|
27340
|
+
if(uncertain){raiseRfiLoad(true);return;}
|
|
27341
|
+
renderRaiseRfi();focusRaise(form.action+':'+q.checkId);}},uncertain?'Discard this attempt':'Cancel'));
|
|
27342
|
+
const hint=rfiRaiseEl('div',{class:'rfinote'},uncertain
|
|
27343
|
+
?'FloLess could not confirm this attempt, so its words are kept as sent. File it again to finish it, or discard it; an RFI it did file will then show here.'
|
|
27344
|
+
:form.value.trim()?'Nothing is saved until you file it.':(form.action==='send'?'Enter who it was sent to, then file it.':'Enter what came back, then file it.'));
|
|
27345
|
+
box.append(lab,hint,acts);
|
|
27346
|
+
return box;
|
|
27347
|
+
}
|
|
27348
|
+
function focusRaise(key){const n=[...document.querySelectorAll('#rfiRaiseList [data-raise-ctl]')].find(e=>e.dataset.raiseCtl===key);if(n)n.focus();}
|
|
27349
|
+
/** File one question: atomic with its first action, and never twice for one intent. */
|
|
27350
|
+
async function raiseRfiFile(checkId){
|
|
27351
|
+
const r=rfiRaise;if(!r||r.busy)return;
|
|
27352
|
+
const q=(r.data&&r.data.questions||[]).find(x=>x.checkId===checkId),form=r.forms.get(checkId);
|
|
27353
|
+
if(!q||!form)return;
|
|
27354
|
+
r.busy=checkId;r.outcomes.delete(checkId);renderRaiseRfi();
|
|
27355
|
+
// A request whose answer never came back is sent again EXACTLY: same bytes, same one-time key.
|
|
27356
|
+
if(!form.request){
|
|
27357
|
+
// The model the person reviewed must be the one filed against: unsaved edits are saved, and a model
|
|
27358
|
+
// that moved since the questions were read has its questions read again before anything is filed.
|
|
27359
|
+
const unsaved=await raiseRfiSaved();
|
|
27360
|
+
if(rfiRaise!==r){return;}
|
|
27361
|
+
if((unsaved&&!r.useSaved)||modelEditGeneration!==r.generation){
|
|
27362
|
+
r.busy=null;
|
|
27363
|
+
r.outcomes.set(checkId,{kind:'refused',text:unsaved&&!r.useSaved?unsaved:'The model changed while this was open, so its questions were read again. Check the question, then file it.'});
|
|
27364
|
+
await raiseRfiLoad(true);return;
|
|
27365
|
+
}
|
|
27366
|
+
form.opKey=form.opKey||newMutationId();
|
|
27367
|
+
const payload=form.action==='send'?{to:form.value.trim()}:{answer:{form:'prose',text:form.value.trim()}};
|
|
27368
|
+
form.request=JSON.stringify({operationKey:form.opKey,jointId:r.jointId,checkId:q.checkId,questionDigest:q.digest,action:form.action,...(q.anchor||{expectedRfiId:null,expectedRfiRevision:null}),...payload});
|
|
27369
|
+
}
|
|
27370
|
+
const ctl=new AbortController();let timedOut=false;const timer=setTimeout(()=>{timedOut=true;ctl.abort();},RFI_RAISE_DEADLINE_MS);
|
|
27371
|
+
let res=null,body=null,threw=false;
|
|
27372
|
+
try{res=await fetch('/api/projects/'+encodeURIComponent(PROJECT)+'/rfis',{method:'POST',headers:{'content-type':'application/json'},body:form.request,signal:ctl.signal});body=await res.json().catch(()=>null);}
|
|
27373
|
+
catch(e){threw=true;console.error('[steel] an RFI about a connection could not be filed',e);}
|
|
27374
|
+
finally{clearTimeout(timer);}
|
|
27375
|
+
r.busy=null;
|
|
27376
|
+
// The dialog was replaced or closed meanwhile (it cannot be while busy, but the page can change):
|
|
27377
|
+
// the outcome is still said where the person is.
|
|
27378
|
+
const here=rfiRaise===r;
|
|
27379
|
+
// NOT A DEFINITE ANSWER: no reply, an unreadable one, a server fault, or a success without its record.
|
|
27380
|
+
// The server may already have filed it, so the exact request and its one-time key are kept.
|
|
27381
|
+
const definite=!threw&&res&&body&&res.status<500&&(res.ok
|
|
27382
|
+
?body.ok===true&&!!body.rfi&&typeof body.rfi.id==='string'&&!!body.rfi.id
|
|
27383
|
+
:body.ok===false&&typeof body.code==='string'&&!!body.code);
|
|
27384
|
+
if(!definite){
|
|
27385
|
+
const said=timedOut?'The server did not answer in time, so FloLess cannot tell whether this was filed. Press the same button again \u2014 the same attempt is never filed twice.'
|
|
27386
|
+
:threw?'FloLess could not reach the server, so it cannot tell whether this was filed. Press the same button again \u2014 the same attempt is never filed twice.'
|
|
27387
|
+
:'FloLess could not confirm whether this was filed. Press the same button again \u2014 the same attempt is never filed twice.';
|
|
27388
|
+
rfiRaiseUnsettled.set(rfiRaiseKey(r.jointId,checkId),{jointId:r.jointId,checkId,form,text:said});
|
|
27389
|
+
if(!here){toast(said,false,9000);return;}
|
|
27390
|
+
r.outcomes.set(checkId,{kind:'unknown',text:said});
|
|
27391
|
+
renderRaiseRfi();focusRaise('submit:'+checkId);return;
|
|
27392
|
+
}
|
|
27393
|
+
// A definite answer settles the attempt, wherever the person now is.
|
|
27394
|
+
rfiRaiseUnsettled.delete(rfiRaiseKey(r.jointId,checkId));
|
|
27395
|
+
if(!here){toast(res.ok?'Filed as '+body.rfi.id+'.':rfiRaiseCap(body.error||'This RFI was not filed.'),false,9000);if(res.ok&&typeof refreshRfiRecords==='function')refreshRfiRecords();return;}
|
|
27396
|
+
if(res.ok&&body&&body.ok===true&&body.rfi&&body.rfi.id){
|
|
27397
|
+
const id=body.rfi.id,said='Filed as '+id+(form.action==='send'?' and marked sent.':' with the answer recorded.');
|
|
27398
|
+
r.forms.delete(checkId);r.outcomes.set(checkId,{kind:'filed',text:said,rfiId:id});
|
|
27399
|
+
q.live={rfiId:id,status:body.rfi.status||(form.action==='send'?'sent':'answered')};
|
|
27400
|
+
toast(said);
|
|
27401
|
+
if(typeof refreshRfiRecords==='function')refreshRfiRecords();
|
|
27402
|
+
renderRaiseRfi();focusRaise('open:'+checkId);return;
|
|
27403
|
+
}
|
|
27404
|
+
const code=body&&typeof body.code==='string'?body.code:'';
|
|
27405
|
+
console.error('[steel] an RFI about a connection was refused',{status:res.status,code,error:body&&body.error});
|
|
27406
|
+
// A definite answer: this attempt is over, so a fresh key goes with the next one.
|
|
27407
|
+
form.opKey=null;form.request=null;
|
|
27408
|
+
const said=body&&typeof body.error==='string'&&body.error?rfiRaiseCap(body.error):'FloLess could not file this RFI just now, and did not say why. Try again in a moment.';
|
|
27409
|
+
if(code==='rfi-connection-question-changed'||code==='rfi-connection-question-gone'||code==='rfi-promote-stale'){
|
|
27410
|
+
r.outcomes.set(checkId,{kind:'refused',text:said+(code==='rfi-connection-question-changed'?' The question was read again: check it, then file it.':'')});
|
|
27411
|
+
await raiseRfiLoad(true);
|
|
27412
|
+
return;
|
|
27413
|
+
}
|
|
27414
|
+
r.outcomes.set(checkId,{kind:'refused',text:said});
|
|
27415
|
+
renderRaiseRfi();focusRaise('submit:'+checkId);
|
|
27416
|
+
}
|
|
27417
|
+
document.getElementById('rfiRaiseClose').onclick=closeRaiseRfi;
|
|
27418
|
+
document.getElementById('rfiRaiseBackdrop').onclick=closeRaiseRfi;
|
|
27419
|
+
document.getElementById('rfiRaiseModal').addEventListener('keydown',e=>{
|
|
27420
|
+
// EVERY key stops here, as in the RFI list: Delete or Enter on a focused button must never reach the
|
|
27421
|
+
// editor behind the dialog, where they would delete the selected connection or repeat a command.
|
|
27422
|
+
e.stopPropagation();
|
|
27423
|
+
if(e.key==='Escape'){e.preventDefault();if(rfiRaise&&rfiRaise.busy){toast('Still filing \u2014 wait for it to finish.');return;}closeRaiseRfi();return;}
|
|
27424
|
+
if(e.key!=='Tab')return;
|
|
27425
|
+
const all=[...document.querySelectorAll('#rfiRaiseModal button,#rfiRaiseModal input,#rfiRaiseModal textarea,#rfiRaiseTitle')].filter(n=>n.offsetParent!==null||n.id==='rfiRaiseTitle');
|
|
27426
|
+
if(!all.length)return;
|
|
27427
|
+
const first=all[0],last=all[all.length-1];
|
|
27428
|
+
if(e.shiftKey&&document.activeElement===first){e.preventDefault();last.focus();}
|
|
27429
|
+
else if(!e.shiftKey&&document.activeElement===last){e.preventDefault();first.focus();}
|
|
27430
|
+
});
|
|
26811
27431
|
function openRFI(focusId,invoker,recordId){focusId=(typeof focusId==='string')?focusId:null; // #rfiStat binds openRFI directly, so the arg is a MouseEvent; only a real id string focuses a row (the profile picker's onApply passes one)
|
|
26812
27432
|
const isElement=value=>typeof Element!=='undefined'&&value instanceof Element;
|
|
26813
27433
|
rfiDialogReturn=isElement(invoker)?invoker:(isElement(document.activeElement)?document.activeElement:null);
|
|
@@ -29812,7 +30432,7 @@ refreshChatLinks(false);window.addEventListener('focus',()=>refreshChatLinks(fal
|
|
|
29812
30432
|
refresh();
|
|
29813
30433
|
})();
|
|
29814
30434
|
|
|
29815
|
-
boot().catch(err => { document.body.replaceChildren(Object.assign(document.createElement('p'), { textContent: 'Failed to load: ' + err.message, style: 'padding:24px;color:var(--err)' })); });
|
|
30435
|
+
boot().catch(err => { EditorFocus.fail('The model did not open, so the connection was not shown. The Model step says why.'); document.body.replaceChildren(Object.assign(document.createElement('p'), { textContent: 'Failed to load: ' + err.message, style: 'padding:24px;color:var(--err)' })); });
|
|
29816
30436
|
|
|
29817
30437
|
// Themed tooltips (replaces native title=) for the 3D toolbar — one shared element, shown on
|
|
29818
30438
|
// data-tip hover after a short delay, positioned below the control and clamped to the viewport. A function of
|