@floless/app 0.150.0 → 0.152.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/floless-server.cjs +19075 -10744
- package/dist/skills/floless-app-knowledge/SKILL.md +25 -2
- package/dist/skills/floless-app-onboarding/SKILL.md +217 -87
- package/dist/skills/floless-app-onboarding/references/aware-runtime.md +27 -18
- package/dist/skills/floless-app-onboarding/references/floless-surfaces.md +207 -0
- package/dist/skills/floless-app-report-issue/SKILL.md +10 -5
- package/dist/skills/floless-app-routines/SKILL.md +1 -1
- package/dist/skills/floless-app-routines/references/routines-api.md +14 -4
- package/dist/templates/revit-model.flo +6 -2
- package/dist/templates/tekla-parser.flo +6 -2
- package/dist/web/agents.js +254 -21
- package/dist/web/app.css +308 -39
- package/dist/web/app.js +67 -115
- package/dist/web/aware.js +1309 -110
- package/dist/web/chat.css +110 -4
- package/dist/web/chat.js +638 -46
- package/dist/web/commands-shell.js +482 -25
- package/dist/web/connections.js +24 -6
- package/dist/web/flo-avatar.js +191 -0
- package/dist/web/flo.js +156 -0
- package/dist/web/guide.js +1313 -0
- package/dist/web/index.html +120 -9
- package/dist/web/instructor.js +14 -3
- package/dist/web/local-discovery.js +35 -6
- package/dist/web/panels.js +2 -0
- package/dist/web/parser-setup-recovery.js +250 -0
- package/dist/web/tool-updates.js +373 -13
- package/dist/web/workspace-root-management.js +197 -0
- package/dist/web/workspaces.js +452 -79
- package/package.json +2 -2
- package/dist/skills/floless-app-onboarding/references/floless-app-tour.md +0 -158
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/* A locally requested file copy and fresh parser setup, with every limitation shown before choosing. */
|
|
2
|
+
(() => {
|
|
3
|
+
let modal;
|
|
4
|
+
let previousFocus;
|
|
5
|
+
let busy = false;
|
|
6
|
+
let selected;
|
|
7
|
+
let preview;
|
|
8
|
+
let incompleteReview = false;
|
|
9
|
+
let dialogGeneration = 0;
|
|
10
|
+
let stateGeneration = 0;
|
|
11
|
+
let folderRequestGeneration = 0;
|
|
12
|
+
const changeState = () => {
|
|
13
|
+
stateGeneration++;
|
|
14
|
+
folderRequestGeneration++;
|
|
15
|
+
modal?.querySelector('[data-setup-status]')?.replaceChildren();
|
|
16
|
+
for (const facts of modal?.querySelectorAll('[data-current-folder]') || []) facts.remove();
|
|
17
|
+
};
|
|
18
|
+
const api = (path, body) => window.flolessBridge.api(path, { method: 'POST', body: JSON.stringify(body) });
|
|
19
|
+
const element = (tag, className, text) => {
|
|
20
|
+
const node = document.createElement(tag);
|
|
21
|
+
if (className) node.className = className;
|
|
22
|
+
if (text) node.textContent = text;
|
|
23
|
+
return node;
|
|
24
|
+
};
|
|
25
|
+
const close = () => {
|
|
26
|
+
if (busy) return;
|
|
27
|
+
dialogGeneration++; changeState();
|
|
28
|
+
modal?.remove(); modal = null;
|
|
29
|
+
const liveCard = selected === 'tekla-parser'
|
|
30
|
+
? document.querySelector('[data-parser-setup="tekla-parser"], [data-module-remedy="tekla-parser"], [data-seed-template="tekla-parser"]')
|
|
31
|
+
: document.querySelector('[data-parser-setup="revit-model"], [data-revit-remedy], [data-seed-template="revit-model"]');
|
|
32
|
+
(previousFocus?.isConnected ? previousFocus : liveCard)?.focus();
|
|
33
|
+
};
|
|
34
|
+
const refreshFocused = () => {
|
|
35
|
+
const focused = document.activeElement;
|
|
36
|
+
if (modal?.contains(focused) && focused.matches('[data-command-id]')) window.Instructor?.refreshCarrier?.(focused);
|
|
37
|
+
};
|
|
38
|
+
const updateBusy = (value, phase = 'checking') => {
|
|
39
|
+
busy = value;
|
|
40
|
+
// Keep keyboard focus inside the dialog before its last focused control is disabled.
|
|
41
|
+
if (value) modal?.focus();
|
|
42
|
+
modal?.setAttribute('aria-busy', String(value));
|
|
43
|
+
for (const button of modal?.querySelectorAll('button') || []) {
|
|
44
|
+
button.disabled = value;
|
|
45
|
+
if (value) button.dataset.blockedReason = phase === 'setup' ? 'Fresh parser setup is in progress. Keep FloLess open until it finishes.' : 'FloLess is checking the parser files.';
|
|
46
|
+
else delete button.dataset.blockedReason;
|
|
47
|
+
}
|
|
48
|
+
refreshFocused();
|
|
49
|
+
};
|
|
50
|
+
const error = (message) => {
|
|
51
|
+
const box = modal.querySelector('[data-setup-error]');
|
|
52
|
+
box.textContent = message; box.hidden = !message;
|
|
53
|
+
};
|
|
54
|
+
function create(id, opener) {
|
|
55
|
+
close(); previousFocus = opener || document.activeElement; selected = id; incompleteReview = false; preview = null;
|
|
56
|
+
dialogGeneration++;
|
|
57
|
+
modal = element('div', 'modal-backdrop show'); modal.id = 'parser-setup-recovery-modal';
|
|
58
|
+
modal.tabIndex = -1;
|
|
59
|
+
modal.setAttribute('role', 'dialog'); modal.setAttribute('aria-modal', 'true'); modal.setAttribute('aria-labelledby', 'parser-setup-recovery-heading');
|
|
60
|
+
const panel = element('div', 'modal revreview');
|
|
61
|
+
const heading = element('div', 'modal-title', `Set up a fresh ${id === 'tekla-parser' ? 'Tekla' : 'Revit'} Parser?`);
|
|
62
|
+
heading.id = 'parser-setup-recovery-heading'; panel.append(heading);
|
|
63
|
+
const body = element('div', 'revreview-body'); body.dataset.setupBody = '';
|
|
64
|
+
body.append(element('p', 'modal-sub', 'Checking the current workflow files…')); panel.append(body);
|
|
65
|
+
const box = element('div', 'modal-error'); box.dataset.setupError = ''; box.hidden = true; box.setAttribute('role', 'alert'); panel.append(box);
|
|
66
|
+
const status = element('p', 'modal-sub'); status.dataset.setupStatus = ''; status.setAttribute('role', 'status'); panel.append(status);
|
|
67
|
+
const actions = element('div', 'modal-actions');
|
|
68
|
+
const cancel = element('button', '', 'Cancel'); cancel.type = 'button'; cancel.dataset.commandId = 'shell.parser-setup-cancel'; cancel.addEventListener('click', close); actions.append(cancel);
|
|
69
|
+
panel.append(actions); modal.append(panel); document.body.append(modal);
|
|
70
|
+
modal.addEventListener('click', (event) => { if (event.target === modal) close(); });
|
|
71
|
+
cancel.focus();
|
|
72
|
+
}
|
|
73
|
+
document.addEventListener('keydown', (event) => {
|
|
74
|
+
if (!modal || (event.key !== 'Escape' && event.key !== 'Tab')) return;
|
|
75
|
+
event.stopImmediatePropagation();
|
|
76
|
+
if (event.key === 'Escape') { event.preventDefault(); close(); return; }
|
|
77
|
+
if (busy) { event.preventDefault(); modal.focus(); return; }
|
|
78
|
+
const buttons = [...modal.querySelectorAll('button:not([disabled])')];
|
|
79
|
+
if (!buttons.length) { event.preventDefault(); modal.focus(); return; }
|
|
80
|
+
const first = buttons[0], last = buttons.at(-1), focused = document.activeElement;
|
|
81
|
+
if (!modal.contains(focused) || focused === modal) {
|
|
82
|
+
event.preventDefault(); (event.shiftKey ? last : first)?.focus();
|
|
83
|
+
} else if (event.shiftKey && focused === first) { event.preventDefault(); last?.focus(); }
|
|
84
|
+
else if (!event.shiftKey && focused === last) { event.preventDefault(); first?.focus(); }
|
|
85
|
+
}, true);
|
|
86
|
+
function action(label, command, callback, primary = false) {
|
|
87
|
+
const button = element('button', primary ? 'primary' : '', label);
|
|
88
|
+
button.type = 'button'; button.dataset.commandId = command; button.addEventListener('click', callback);
|
|
89
|
+
modal.querySelector('.modal-actions').append(button); return button;
|
|
90
|
+
}
|
|
91
|
+
function renderPreview() {
|
|
92
|
+
changeState();
|
|
93
|
+
const body = modal.querySelector('[data-setup-body]'); body.replaceChildren();
|
|
94
|
+
modal.querySelector('#parser-setup-recovery-heading').textContent = incompleteReview ? 'The copy would be incomplete' : `Set up a fresh ${selected === 'tekla-parser' ? 'Tekla' : 'Revit'} Parser?`;
|
|
95
|
+
body.append(element('p', 'approval-impact', 'The current shared parser could not be verified. You can keep its workflow files and prepare the packaged parser instead.'));
|
|
96
|
+
body.append(element('h3', '', 'Kept'), element('p', '', 'Your project files and signed approval history stay. FloLess saves a copy of readable workflow and same-name agent files.'));
|
|
97
|
+
body.append(element('h3', '', 'Replaced'), element('p', '', 'The shared parser returns to the packaged version. This does not approve a model. FloLess cannot tell which projects used the previous parser. Open a project’s Audit and Approve steps when you need its approved model in the shared parser.'));
|
|
98
|
+
body.append(element('p', '', 'Original folder from this review'));
|
|
99
|
+
const originalPath = element('code', '', preview.originalFolder); originalPath.dataset.tip = preview.originalFolder; body.append(originalPath);
|
|
100
|
+
body.append(element('h3', '', 'Copy limits'));
|
|
101
|
+
for (const limitation of preview.limitations || []) body.append(element('p', '', limitation));
|
|
102
|
+
if (preview.omissions?.length) {
|
|
103
|
+
body.append(element('h3', '', 'Files that cannot be copied'));
|
|
104
|
+
const list = element('ul'); for (const item of preview.omissions) list.append(element('li', '', item)); body.append(list);
|
|
105
|
+
body.append(element('p', 'approval-impact', incompleteReview
|
|
106
|
+
? 'Continuing will replace the parser without a complete copy. These missing items will be recorded with the result.'
|
|
107
|
+
: 'Repair these items and try again, or review the separate choice to continue without a complete copy.'));
|
|
108
|
+
}
|
|
109
|
+
const actions = modal.querySelector('.modal-actions'); while (actions.children.length > 1) actions.lastChild.remove();
|
|
110
|
+
action('Try setup again', 'shell.parser-setup-retry', retry);
|
|
111
|
+
action('Show original folder', 'shell.parser-setup-show-original', showFolder('original'));
|
|
112
|
+
if (preview.omissions?.length && !incompleteReview) action('Review incomplete copy…', 'shell.parser-setup-review-incomplete', () => { incompleteReview = true; renderPreview(); });
|
|
113
|
+
else {
|
|
114
|
+
const choice = action(incompleteReview ? 'Set up fresh without a complete copy' : 'Keep a copy and set up fresh',
|
|
115
|
+
incompleteReview ? 'shell.parser-setup-confirm-incomplete' : 'shell.parser-setup-confirm', confirm, true);
|
|
116
|
+
if (incompleteReview) choice.className = 'danger';
|
|
117
|
+
}
|
|
118
|
+
actions.firstChild.focus(); refreshFocused();
|
|
119
|
+
}
|
|
120
|
+
const parserName = () => `${selected === 'tekla-parser' ? 'Tekla' : 'Revit'} Parser`;
|
|
121
|
+
const failureText = (code, status) => {
|
|
122
|
+
if (status === 401 || status === 403) return 'Please sign in again to review parser setup.';
|
|
123
|
+
if (code === 'parser-setup-choice-changed') return "Fresh setup didn't finish. If files are left in the original folder, move or repair them. Then choose Try setup again to review the choices.";
|
|
124
|
+
if (code === 'registry-release-missing') return `Fresh setup didn't finish because ${selected === 'revit-model' ? 'the Revit reader' : 'a parser component'} it needs isn't available to download. Try setup again later, or close this dialog and report this setup issue from the ${parserName()} card.`;
|
|
125
|
+
return `FloLess couldn't finish this setup step. Choose Try setup again to check the current files, or close this dialog and follow the ${parserName()} card.`;
|
|
126
|
+
};
|
|
127
|
+
function copyFacts(copy, body) {
|
|
128
|
+
if (!copy) return;
|
|
129
|
+
body.append(element('p', '', `Copy saved ${new Date(copy.at).toLocaleString()} · ${copy.completeCopy ? 'complete' : 'incomplete'}`));
|
|
130
|
+
const path = element('code', '', copy.backupPath); path.dataset.tip = copy.backupPath; body.append(path);
|
|
131
|
+
for (const item of copy.omissions || []) body.append(element('p', '', item));
|
|
132
|
+
}
|
|
133
|
+
function showFolder(kind) {
|
|
134
|
+
return async () => {
|
|
135
|
+
const origin = modal, parser = selected, dialog = dialogGeneration, state = stateGeneration;
|
|
136
|
+
const request = ++folderRequestGeneration;
|
|
137
|
+
const active = () => modal === origin && origin?.isConnected && selected === parser
|
|
138
|
+
&& dialogGeneration === dialog && stateGeneration === state && folderRequestGeneration === request;
|
|
139
|
+
origin.querySelector('[data-setup-status]').textContent = '';
|
|
140
|
+
origin.querySelector('[data-folder-fact="action"]')?.remove();
|
|
141
|
+
let result, failed = false, failureStatus;
|
|
142
|
+
try { result = await api(`/api/parser-setup/show-${kind}`, { appId: parser }); }
|
|
143
|
+
catch (failure) { result = failure.body; failureStatus = failure.status; failed = true; }
|
|
144
|
+
if (!active()) return;
|
|
145
|
+
const signingIn = failureStatus === 401 || failureStatus === 403;
|
|
146
|
+
const folder = result?.currentFolder;
|
|
147
|
+
const path = !signingIn && folder?.kind === kind && typeof folder.path === 'string' && folder.path ? folder.path : null;
|
|
148
|
+
const failureFacts = origin.querySelector('[data-folder-fact="failure"]');
|
|
149
|
+
if (kind === 'original' && failureFacts) {
|
|
150
|
+
if (path) currentFolderFacts(path, kind, origin, 'failure');
|
|
151
|
+
else if (failed && !signingIn && result && typeof result === 'object') failureFacts.remove();
|
|
152
|
+
}
|
|
153
|
+
if (failed && path && !(kind === 'original' && failureFacts)) currentFolderFacts(path, kind, origin);
|
|
154
|
+
if (failed) origin.querySelector('[data-setup-status]').textContent = signingIn
|
|
155
|
+
? 'Please sign in again to open this folder.'
|
|
156
|
+
: !result && kind === 'original' && failureFacts
|
|
157
|
+
? "FloLess couldn't check this folder right now. The original folder path shown above is from the last check. Choose Try setup again to check the current files, or close this dialog and choose Report an issue in the footer."
|
|
158
|
+
: path
|
|
159
|
+
? "FloLess couldn't open this folder. Copy the path shown above and open it in your file manager."
|
|
160
|
+
: kind === 'copy'
|
|
161
|
+
? "FloLess can't open or find the saved copy right now. Close this dialog and choose Report an issue in the footer."
|
|
162
|
+
: "FloLess can't open or find this folder right now. Choose Try setup again to check the current files, or close this dialog and choose Report an issue in the footer.";
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function currentFolderFacts(path, kind, origin = modal, role = 'action') {
|
|
166
|
+
origin.querySelector(`[data-folder-fact="${role}"]`)?.remove();
|
|
167
|
+
const body = origin.querySelector('[data-setup-body]');
|
|
168
|
+
if (role === 'action' && [...body.querySelectorAll('code')].some(code => code.textContent === path)) return;
|
|
169
|
+
const facts = element('div'); facts.dataset.currentFolder = ''; facts.dataset.folderFact = role;
|
|
170
|
+
facts.append(element('p', '', kind === 'copy' ? 'Saved copy folder' : 'Original folder'));
|
|
171
|
+
const code = element('code', '', path); code.dataset.tip = path; facts.append(code);
|
|
172
|
+
if (role === 'failure') body.prepend(facts);
|
|
173
|
+
else body.append(facts);
|
|
174
|
+
}
|
|
175
|
+
function renderFailure(failure) {
|
|
176
|
+
changeState();
|
|
177
|
+
incompleteReview = false;
|
|
178
|
+
const code = failure.body?.code || failure.body?.failureCode;
|
|
179
|
+
const signingIn = failure.status === 401 || failure.status === 403;
|
|
180
|
+
modal.querySelector('#parser-setup-recovery-heading').textContent = `${parserName()} setup needs attention`;
|
|
181
|
+
const body = modal.querySelector('[data-setup-body]'); body.replaceChildren();
|
|
182
|
+
const folder = failure.body?.currentFolder;
|
|
183
|
+
if (!signingIn && code !== 'registry-release-missing' && folder?.kind === 'original' && typeof folder.path === 'string' && folder.path) {
|
|
184
|
+
currentFolderFacts(folder.path, 'original', modal, 'failure');
|
|
185
|
+
}
|
|
186
|
+
copyFacts(failure.body?.copy, body);
|
|
187
|
+
const actions = modal.querySelector('.modal-actions'); actions.replaceChildren();
|
|
188
|
+
action('Cancel', 'shell.parser-setup-cancel', close);
|
|
189
|
+
if (!signingIn && code !== 'registry-release-missing') action('Show original folder', 'shell.parser-setup-show-original', showFolder('original'));
|
|
190
|
+
if (!signingIn && failure.body?.copy) action('Show saved copy', 'shell.parser-setup-show-copy', showFolder('copy'));
|
|
191
|
+
if (!signingIn) action('Try setup again', 'shell.parser-setup-retry', retry);
|
|
192
|
+
error(failureText(code, failure.status)); updateBusy(false); actions.firstChild.focus(); refreshFocused();
|
|
193
|
+
}
|
|
194
|
+
function renderReady(copy) {
|
|
195
|
+
changeState();
|
|
196
|
+
error(''); modal.querySelector('#parser-setup-recovery-heading').textContent = `${parserName()} is ready`;
|
|
197
|
+
const body = modal.querySelector('[data-setup-body]'); body.replaceChildren();
|
|
198
|
+
body.append(element('p', '', copy ? `${parserName()} is ready. This does not approve a model.` : `${parserName()} is ready. FloLess has no verified copy from this choice to show.`));
|
|
199
|
+
copyFacts(copy, body);
|
|
200
|
+
const actions = modal.querySelector('.modal-actions'); actions.replaceChildren();
|
|
201
|
+
if (copy) action('Show saved copy', 'shell.parser-setup-show-copy', showFolder('copy'));
|
|
202
|
+
const done = action('Done', 'shell.parser-setup-done', close, true); updateBusy(false); done.focus(); refreshFocused();
|
|
203
|
+
}
|
|
204
|
+
const isReady = (result) => {
|
|
205
|
+
const setup = result.setup || result;
|
|
206
|
+
if (setup.apps && Object.prototype.hasOwnProperty.call(setup.apps, selected)) return setup.apps[selected] === 'ready';
|
|
207
|
+
return (setup.parserStatus || setup.status) === 'ready';
|
|
208
|
+
};
|
|
209
|
+
async function load(notice = '') {
|
|
210
|
+
changeState();
|
|
211
|
+
updateBusy(true); error(notice);
|
|
212
|
+
try {
|
|
213
|
+
preview = await api('/api/parser-setup/preview', { appId: selected });
|
|
214
|
+
if (modal) { renderPreview(); error(notice); }
|
|
215
|
+
} catch (failure) { if (modal) renderFailure(failure); }
|
|
216
|
+
finally { updateBusy(false); modal?.querySelector('.modal-actions button')?.focus(); refreshFocused(); }
|
|
217
|
+
}
|
|
218
|
+
async function retry() {
|
|
219
|
+
changeState();
|
|
220
|
+
updateBusy(true); error('');
|
|
221
|
+
try {
|
|
222
|
+
const result = await api(selected === 'tekla-parser' ? '/api/tekla-defaults/retry' : '/api/rvt-defaults/retry', {});
|
|
223
|
+
if (isReady(result)) { renderReady(null); return; }
|
|
224
|
+
incompleteReview = false;
|
|
225
|
+
await load(`${failureText(result.code || result.failureCode)} The setup choices were refreshed. Review them before continuing.`);
|
|
226
|
+
} catch (failure) { renderFailure(failure); }
|
|
227
|
+
finally { updateBusy(false); }
|
|
228
|
+
}
|
|
229
|
+
async function confirm() {
|
|
230
|
+
changeState();
|
|
231
|
+
updateBusy(true, 'setup'); error(''); modal.querySelector('[data-setup-status]').textContent = 'Setting up a fresh parser. Keep FloLess open.';
|
|
232
|
+
try {
|
|
233
|
+
const result = await api('/api/parser-setup/confirm', { appId: selected, fingerprint: preview.fingerprint,
|
|
234
|
+
templateSha256: preview.templateSha256, allowIncompleteCopy: incompleteReview });
|
|
235
|
+
if (isReady(result)) renderReady(result.copy);
|
|
236
|
+
else renderFailure({ body: result });
|
|
237
|
+
} catch (failure) { renderFailure(failure); }
|
|
238
|
+
finally { modal?.querySelector('[data-setup-status]')?.replaceChildren(); updateBusy(false); }
|
|
239
|
+
}
|
|
240
|
+
window.flolessParserSetupRecovery = { open: async (id, opener) => {
|
|
241
|
+
if (busy) return; create(id, opener); updateBusy(true);
|
|
242
|
+
try {
|
|
243
|
+
// Use the established browser session once. Recreating it between preview and confirm
|
|
244
|
+
// would invalidate the exact local UI decision; desktop IPC sessions already carry it.
|
|
245
|
+
const response = await fetch('/api/editor/session', { method: 'POST', credentials: 'same-origin' });
|
|
246
|
+
if (!response.ok && response.status !== 403) throw new Error('The local browser session could not be opened. Close this dialog and sign in again.');
|
|
247
|
+
await load();
|
|
248
|
+
} catch (failure) { renderFailure(failure); }
|
|
249
|
+
} };
|
|
250
|
+
})();
|