@floless/app 0.124.1 → 0.125.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 +90 -35
- package/dist/schemas/steel.model.v2.schema.json +1 -0
- package/dist/skills/floless-app-bridge/SKILL.md +43 -13
- package/dist/skills/floless-app-queue/SKILL.md +2 -2
- package/dist/skills/floless-app-steel-takeoff/SKILL.md +10 -3
- package/dist/web/app.css +98 -11
- package/dist/web/app.js +99 -25
- package/dist/web/aware.js +297 -34
- package/dist/web/index.html +16 -4
- package/dist/web/steel-editor.html +218 -21
- package/dist/web/steel-model-v2-commands.js +1 -1
- package/dist/web/steel-model-v2-projection.js +1 -1
- package/dist/web/vector-editor.html +43 -1
- package/dist/web/workspaces.js +87 -82
- package/package.json +2 -1
package/dist/web/app.js
CHANGED
|
@@ -135,33 +135,107 @@ function onboardingHtml() {
|
|
|
135
135
|
`</div>`
|
|
136
136
|
);
|
|
137
137
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
138
|
+
// Wire a "Start the guided tour" button: copy the natural-language onboarding prompt so the user can
|
|
139
|
+
// paste it into their terminal AI to launch the tour (the floless-app-onboarding skill), and confirm
|
|
140
|
+
// in place. SHARED — the Workflows first-run card below and the Workspaces zero-projects empty state
|
|
141
|
+
// (workspaces.js, #598) are two entry points to the SAME tour, so they must not drift in prompt text,
|
|
142
|
+
// confirmation wording, or reset timing; one function is what guarantees that.
|
|
143
|
+
// Markup contract: a button may be bare text (it is then its own label), or split into
|
|
144
|
+
// `.onb-tour-label` + `.onb-tour-ico` — never an icon span with no label span, which would have the
|
|
145
|
+
// label swap wipe the icon out. Its `[aria-live]` region is found as a sibling rather than passed in,
|
|
146
|
+
// so a call site cannot quietly wire a button with no way to announce the result.
|
|
147
|
+
function wireTourCopy(btn) {
|
|
148
|
+
if (!btn) return;
|
|
149
|
+
const ico = btn.querySelector('.onb-tour-ico');
|
|
150
|
+
const label = btn.querySelector('.onb-tour-label') || btn;
|
|
151
|
+
// Loud, because that mistake is otherwise invisible AND permanent: with no label span the swap below
|
|
152
|
+
// writes over the whole button, destroying the icon element, and the reset restores flat text. The
|
|
153
|
+
// button keeps "working", so nothing else would ever report it.
|
|
154
|
+
if (ico && label === btn) console.error('[onboarding] a tour button with .onb-tour-ico must also have .onb-tour-label — the label swap will destroy the icon', btn);
|
|
155
|
+
const live = btn.parentElement ? btn.parentElement.querySelector('[aria-live]') : null;
|
|
156
|
+
// Equally loud. Finding the region by structure keeps the two call sites from passing mismatched
|
|
157
|
+
// selectors, but it also means an extra wrapper around the button silently costs every screen-reader
|
|
158
|
+
// announcement — and the four `if (live)` guards below would hide that forever. Say so instead.
|
|
159
|
+
if (!live) console.error('[onboarding] no [aria-live] sibling for this tour button — the copy result will not be announced', btn);
|
|
160
|
+
// Read the idle text off the DOM rather than hardcoding it — the two call sites label the action
|
|
161
|
+
// differently ("Start the guided tour" vs "Start the guided tour →") and only the markup knows which.
|
|
162
|
+
const idleLabel = label.textContent;
|
|
163
|
+
const idleIco = ico ? ico.textContent : '';
|
|
164
|
+
btn.onclick = async () => {
|
|
165
|
+
// ONLY the copy goes inside the try. Wrapping the confirmation too meant a throw anywhere in it
|
|
166
|
+
// (showToast dereferences #toast-container unguarded) landed in the catch with the button already
|
|
167
|
+
// disabled and the reset never scheduled — a permanently stuck "Copied ✓" under a toast saying the
|
|
168
|
+
// copy failed. That was the one path where this button could actively misinform.
|
|
169
|
+
try {
|
|
170
|
+
await navigator.clipboard.writeText(ONB_TOUR_PROMPT);
|
|
171
|
+
} catch (err) {
|
|
172
|
+
// Bind and log it: "navigator.clipboard is undefined" (insecure context / blocked by policy —
|
|
173
|
+
// permanent) and "writeText rejected" (denied, or the document wasn't focused — often retryable)
|
|
174
|
+
// reach the user as one message, and with nothing logged a bug report can't separate them either.
|
|
175
|
+
console.error('[onboarding] could not copy the tour prompt', err);
|
|
176
|
+
revealTourPrompt(btn, live);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
// Disabling a focused control blurs it, and re-enabling does NOT bring focus back — so a keyboard
|
|
180
|
+
// user would be dropped to <body> for the whole confirmation and have to tab in from the top
|
|
181
|
+
// again. Restore it: the same discipline retryProjects() applies on this very surface.
|
|
182
|
+
// MUST be read before disabling, which blurs it — after, this is always false.
|
|
183
|
+
const hadFocus = document.activeElement === btn;
|
|
184
|
+
btn.disabled = true;
|
|
185
|
+
label.textContent = 'Copied';
|
|
186
|
+
if (ico) ico.textContent = '✓';
|
|
187
|
+
if (live) live.textContent = 'Copied to clipboard';
|
|
188
|
+
// A successful copy retires any prompt a previous refusal put on screen — otherwise a stale
|
|
189
|
+
// "copy this manually" field sits under a button reading "Copied ✓", contradicting it.
|
|
190
|
+
const stale = btn.parentElement ? btn.parentElement.querySelector('.onb-tour-manual') : null;
|
|
191
|
+
if (stale) stale.remove();
|
|
192
|
+
setTimeout(() => {
|
|
193
|
+
label.textContent = idleLabel;
|
|
194
|
+
if (ico) ico.textContent = idleIco;
|
|
195
|
+
btn.disabled = false;
|
|
196
|
+
if (live) live.textContent = '';
|
|
197
|
+
// Only take focus back if it is still nowhere. 1600 ms is long enough for the user to click or
|
|
198
|
+
// tab onto something else — and a mouse click focuses the button too, so `hadFocus` alone would
|
|
199
|
+
// yank focus out of whatever they moved to. isConnected because a repaint may have replaced this
|
|
200
|
+
// node, and focusing a detached button drops them to <body>: the very thing this prevents.
|
|
201
|
+
const parked = document.activeElement;
|
|
202
|
+
if (hadFocus && btn.isConnected && (!parked || parked === document.body)) {
|
|
203
|
+
btn.focus({ focusVisible: true, preventScroll: true });
|
|
162
204
|
}
|
|
163
|
-
};
|
|
205
|
+
}, 1600);
|
|
206
|
+
showToast('Copied — paste it into your terminal AI', 'ok');
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
// The clipboard is this button's ONLY route into onboarding, and the prompt is rendered nowhere — so
|
|
210
|
+
// "copy it manually" asks for something the user cannot do: there is nothing on screen to copy. Put
|
|
211
|
+
// the prompt on screen, selected, and the message becomes true. Both entry points inherit this.
|
|
212
|
+
function revealTourPrompt(btn, live) {
|
|
213
|
+
const host = btn.parentElement;
|
|
214
|
+
let box = host ? host.querySelector('.onb-tour-manual') : null;
|
|
215
|
+
if (host && !box) {
|
|
216
|
+
// A textarea, not an input: the prompt is wider than the Workflows card, and a single-line input
|
|
217
|
+
// clips it mid-sentence. Selecting still copies the whole thing, but "copy it manually" is only
|
|
218
|
+
// honest if the user can also READ what they are copying.
|
|
219
|
+
box = document.createElement('textarea');
|
|
220
|
+
box.className = 'onb-tour-manual';
|
|
221
|
+
box.rows = 2;
|
|
222
|
+
box.readOnly = true;
|
|
223
|
+
box.value = ONB_TOUR_PROMPT;
|
|
224
|
+
box.setAttribute('aria-label', 'The onboarding prompt — copy this and paste it into your terminal AI');
|
|
225
|
+
host.appendChild(box);
|
|
164
226
|
}
|
|
227
|
+
// focus+setSelectionRange, not select(): select() scrolls the element into view with no way to
|
|
228
|
+
// opt out, and on the Workflows card that means scrolling inside .canvas (overflow:hidden) whose
|
|
229
|
+
// .topology child is the pan/zoom transformed world — a scrollTop nothing can put back.
|
|
230
|
+
if (box) { box.focus({ preventScroll: true }); box.setSelectionRange(0, box.value.length); }
|
|
231
|
+
if (live) live.textContent = 'Could not copy. The prompt is now shown — copy it manually.';
|
|
232
|
+
showToast(box
|
|
233
|
+
? 'Couldn’t reach the clipboard — the prompt is shown below; copy it manually.'
|
|
234
|
+
: 'Could not copy — this browser is blocking the clipboard.', 'warn');
|
|
235
|
+
}
|
|
236
|
+
function wireOnboardingCopy() {
|
|
237
|
+
// The primary first-run action on the empty canvas.
|
|
238
|
+
wireTourCopy($topology.querySelector('.onb-tour-btn'));
|
|
165
239
|
// Secondary first-run action: "Build your first workflow" — the empty canvas is the
|
|
166
240
|
// highest-intent moment to create one, so surface the same relay the ≡ menu's "New
|
|
167
241
|
// workflow…" fires (handleMenuAction is reassigned in aware.js → requestNewWorkflow).
|
package/dist/web/aware.js
CHANGED
|
@@ -6868,7 +6868,19 @@
|
|
|
6868
6868
|
return `In floless project "${req.project}", reshape the Project Knowledge Base with your floless-app-knowledge skill: ${req.instruction || 'apply the requested change'}. ` +
|
|
6869
6869
|
`Edit the project's wiki notes accordingly, then re-organize so the published generation reflects the change.`;
|
|
6870
6870
|
}
|
|
6871
|
-
|
|
6871
|
+
// No branch matched. Fall back to what the USER typed rather than to nothing.
|
|
6872
|
+
//
|
|
6873
|
+
// Every type in the union has an arm today — 'tweak-contract' was the last one missing and #629
|
|
6874
|
+
// gave it one. This is the floor for the NEXT type added to FlolessRequest before its arm lands,
|
|
6875
|
+
// because of what that gap cost last time: a blank row in the Requests window AND a
|
|
6876
|
+
// markedInstruction() of '', so the ⧉ silently put nothing on the clipboard while still toasting
|
|
6877
|
+
// success. The request was never empty — it carried a real instruction — it was just unreadable
|
|
6878
|
+
// and uncopyable, which reads as noise worth deleting.
|
|
6879
|
+
//
|
|
6880
|
+
// A composed arm is strictly better (it tells the terminal AI the protocol, not just the wish),
|
|
6881
|
+
// so this never competes with one: every arm above returns first. A type that legitimately
|
|
6882
|
+
// carries no instruction still lands on '' here, and the row says so in words.
|
|
6883
|
+
return req.instruction ? String(req.instruction).trim() : '';
|
|
6872
6884
|
}
|
|
6873
6885
|
|
|
6874
6886
|
// Which product skill applies each request type (named in the copied marker so the
|
|
@@ -7033,6 +7045,12 @@
|
|
|
7033
7045
|
}
|
|
7034
7046
|
|
|
7035
7047
|
let pendingRequests = [];
|
|
7048
|
+
// The Workspaces project the Requests window scopes to, pushed by workspaces.js's applyMode()
|
|
7049
|
+
// (null in Workflows mode, or on the Workspaces landing). Non-null ⇒ Workspaces with a project
|
|
7050
|
+
// open, which is why activeRequestScope() can pick between the two modes from this alone.
|
|
7051
|
+
let wsRequestScope = null;
|
|
7052
|
+
let requestScopeAll = false; // the scope tab: false = what's open, true = every queued request
|
|
7053
|
+
let requestQuery = '';
|
|
7036
7054
|
let previousRequestCount = 0;
|
|
7037
7055
|
let previousRequestIds = null;
|
|
7038
7056
|
let reqPulseTimer = null;
|
|
@@ -7063,6 +7081,161 @@
|
|
|
7063
7081
|
} catch { /* non-fatal */ }
|
|
7064
7082
|
}
|
|
7065
7083
|
|
|
7084
|
+
// What the Requests window is scoped to right now: the open Workspaces project, else the open
|
|
7085
|
+
// workflow, else nothing (the Workspaces landing / no workflow selected → no filter is offered).
|
|
7086
|
+
function activeRequestScope() {
|
|
7087
|
+
// A Workspaces scope answers for itself, INCLUDING when it says "nothing" ({kind:'none'} —
|
|
7088
|
+
// the landing). Falling through to currentId there would scope the window to a workflow while
|
|
7089
|
+
// the user is looking at project cards: the workflow combo isn't even visible in Workspaces
|
|
7090
|
+
// mode, so the filter would name a surface they can't see. Same inverse-scope trap
|
|
7091
|
+
// workspaces.js's applyMode() documents for the tab title.
|
|
7092
|
+
if (wsRequestScope) return wsRequestScope.kind === 'project' ? wsRequestScope : null;
|
|
7093
|
+
return currentId ? { kind: 'workflow', appId: currentId, label: currentId } : null;
|
|
7094
|
+
}
|
|
7095
|
+
|
|
7096
|
+
/**
|
|
7097
|
+
* Does this queued request belong to what the user has open? (Pure — unit-tested.)
|
|
7098
|
+
*
|
|
7099
|
+
* Three cases, and the middle one is the whole point of the filter:
|
|
7100
|
+
* - A request with NEITHER appId nor project ('ui-customize', 'new-workflow') belongs to no
|
|
7101
|
+
* scope at all, so it is always shown. Hiding it would strand it: it can never match any
|
|
7102
|
+
* scope, and a "New workflow…" you just queued vanishing while the footer counter ticks up
|
|
7103
|
+
* is worse than one extra row.
|
|
7104
|
+
* - A PROJECT scope matches on project id only. A Workspaces tweak-contract carries both a
|
|
7105
|
+
* project and its app, so matching on appId would pull in every OTHER project sharing that
|
|
7106
|
+
* app — six 'steel-model' projects here all bleed into each other.
|
|
7107
|
+
* - A WORKFLOW scope requires `!r.project` for the same reason in reverse: the workflow
|
|
7108
|
+
* `steel-model` is not the Workspaces projects built on it.
|
|
7109
|
+
*/
|
|
7110
|
+
function requestInScope(r, scope) {
|
|
7111
|
+
if (!scope) return true;
|
|
7112
|
+
if (!r) return false;
|
|
7113
|
+
if (!r.appId && !r.project) return true;
|
|
7114
|
+
if (scope.project) return r.project === scope.project;
|
|
7115
|
+
return !r.project && !!scope.appId && r.appId === scope.appId;
|
|
7116
|
+
}
|
|
7117
|
+
|
|
7118
|
+
/** Scope + free-text filter over the queue. `textOf` yields a request's searchable text. (Pure.) */
|
|
7119
|
+
function visibleRequests(list, scope, query, textOf) {
|
|
7120
|
+
const q = String(query || '').trim().toLowerCase();
|
|
7121
|
+
return (list || []).filter((r) => requestInScope(r, scope)
|
|
7122
|
+
&& (!q || String(textOf(r) || '').toLowerCase().includes(q)));
|
|
7123
|
+
}
|
|
7124
|
+
|
|
7125
|
+
/**
|
|
7126
|
+
* WHAT a request belongs to, in the words the user knows it by: the project's name in
|
|
7127
|
+
* Workspaces, the workflow's id in Workflows. (Pure — unit-tested.)
|
|
7128
|
+
*
|
|
7129
|
+
* The project name comes from the server (`projectName` on the request view), because the
|
|
7130
|
+
* request itself only carries the project ID and the id is neither the name nor stable against
|
|
7131
|
+
* a rename. Falls back to the id when the server could resolve no name — a stale id is honest,
|
|
7132
|
+
* an invented name is not. That fallback is reached most often after a RENAME (which mints a new
|
|
7133
|
+
* project id and leaves the queued request on the old one), not a delete; see the note on
|
|
7134
|
+
* requestProjectName in server/index.ts for what the user sees when it happens.
|
|
7135
|
+
*
|
|
7136
|
+
* A project-keyed request must NEVER fall through to appId: every steel-model project carries
|
|
7137
|
+
* `appId: "steel-model"`, so the old head line printed the same word against three unrelated
|
|
7138
|
+
* projects' work. Requests that belong to neither (ui-customize, new-workflow) get a plain-English
|
|
7139
|
+
* stand-in rather than a blank — the row still has to say what it is about.
|
|
7140
|
+
*/
|
|
7141
|
+
function requestOwnerName(r) {
|
|
7142
|
+
if (!r) return '';
|
|
7143
|
+
if (r.project) return r.projectName || r.project;
|
|
7144
|
+
if (r.appId) return r.appId;
|
|
7145
|
+
return r.type === 'ui-customize' ? 'your dashboard' : r.type === 'new-workflow' ? 'a new workflow' : '';
|
|
7146
|
+
}
|
|
7147
|
+
|
|
7148
|
+
// Everything a search should match: the project/workflow the request belongs to, its badge
|
|
7149
|
+
// label, and the instruction the terminal AI would receive.
|
|
7150
|
+
//
|
|
7151
|
+
// `r.instruction` — what the USER actually typed — is searched alongside the composed
|
|
7152
|
+
// instruction, not instead of it. The two usually overlap, but the composed body is only as
|
|
7153
|
+
// complete as instructionFor()'s arms, and a request you can see but cannot find by the words
|
|
7154
|
+
// you wrote in it is the worst kind of search. Same forward-looking floor as the fallback at the
|
|
7155
|
+
// end of instructionFor(): keep this field even though every type has an arm today.
|
|
7156
|
+
//
|
|
7157
|
+
// Both the NAME and the raw ids are searchable: you may know a project as "Cedar Mill Warehouse"
|
|
7158
|
+
// or as the `take-5-6677ee` in its URL, and either should find it.
|
|
7159
|
+
function requestSearchText(r) {
|
|
7160
|
+
return [requestLabel(r), requestOwnerName(r), r.appId, r.project, r.nodeId, r.inputName, r.instruction, instructionFor(r)]
|
|
7161
|
+
.filter(Boolean).join(' ');
|
|
7162
|
+
}
|
|
7163
|
+
|
|
7164
|
+
function requestLabel(r) {
|
|
7165
|
+
return r.type === 'use-template' ? 'template' : r.type === 'ui-customize' ? 'dashboard' : r.type === 'rebake' ? 're-bake' : r.type === 'revision-read' ? 'revision' : r.type === 'guide' ? 'guide' : r.type === 'new-workflow' ? 'new workflow' : r.type === 'knowledge-organize' ? 'organize' : r.type === 'knowledge-adjust' ? 'adjust' : r.type === 'tweak-contract' ? 'contract' : 'tweak';
|
|
7166
|
+
}
|
|
7167
|
+
|
|
7168
|
+
// Escape `text`, wrapping every case-insensitive occurrence of `q` in <mark>. Splits the RAW
|
|
7169
|
+
// string and escapes each piece, so the match offsets stay valid (escaping first would shift
|
|
7170
|
+
// them) and no user text can escape into markup.
|
|
7171
|
+
//
|
|
7172
|
+
// Matches with a case-insensitive RegExp rather than indexOf over a lowercased copy, because
|
|
7173
|
+
// case folding is not length-preserving: 'İ'.toLowerCase() is TWO code units, so every offset
|
|
7174
|
+
// past one would slice the original at the wrong place and garble the text it rendered. The
|
|
7175
|
+
// needle is regex-escaped — a user typing `.` or `(` into the search box is a literal, not a
|
|
7176
|
+
// pattern.
|
|
7177
|
+
function highlightQuery(text, q) {
|
|
7178
|
+
const s = String(text == null ? '' : text);
|
|
7179
|
+
const needle = String(q || '').trim();
|
|
7180
|
+
if (!needle) return escapeHtml(s);
|
|
7181
|
+
const re = new RegExp(needle.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), 'gi');
|
|
7182
|
+
let out = '';
|
|
7183
|
+
let i = 0;
|
|
7184
|
+
for (let m = re.exec(s); m; m = re.exec(s)) {
|
|
7185
|
+
out += `${escapeHtml(s.slice(i, m.index))}<mark>${escapeHtml(m[0])}</mark>`;
|
|
7186
|
+
i = m.index + m[0].length;
|
|
7187
|
+
if (m[0].length === 0) re.lastIndex++; // defensive: an empty match would never advance
|
|
7188
|
+
}
|
|
7189
|
+
return out + escapeHtml(s.slice(i));
|
|
7190
|
+
}
|
|
7191
|
+
|
|
7192
|
+
// The set the window is currently showing — the ONE definition of "these requests", so the
|
|
7193
|
+
// rows and the counts on the scope tabs can never disagree.
|
|
7194
|
+
function shownRequests() {
|
|
7195
|
+
return visibleRequests(pendingRequests, requestScopeAll ? null : activeRequestScope(), requestQuery, requestSearchText);
|
|
7196
|
+
}
|
|
7197
|
+
|
|
7198
|
+
// Exactly what the OPEN window last painted. The bulk actions read THIS, never shownRequests().
|
|
7199
|
+
//
|
|
7200
|
+
// Re-deriving the scope at click time reads module state that changes with no repaint: `loadApps()`
|
|
7201
|
+
// reassigns `currentId` (it falls back to list[0] when the remembered app is gone) and it runs from
|
|
7202
|
+
// the `apps-changed` SSE — so the terminal AI reinstalling a workflow, or another tab deleting one,
|
|
7203
|
+
// silently moves the scope under an open modal. "Clear all" would then delete a set the user was
|
|
7204
|
+
// never shown while the rows and the tab label still named the old one. Before this window could be
|
|
7205
|
+
// scoped, both handlers read `pendingRequests` — the rendered array itself — so a stale `currentId`
|
|
7206
|
+
// was inert; scoping is what promoted it to an input of what a click DELETES.
|
|
7207
|
+
let shownSnapshot = [];
|
|
7208
|
+
|
|
7209
|
+
// The snapshot, re-resolved against the live queue: anything cleared elsewhere since the paint is
|
|
7210
|
+
// dropped rather than re-DELETEd into a 404.
|
|
7211
|
+
function paintedRequests() {
|
|
7212
|
+
const live = new Map(pendingRequests.map((r) => [r.id, r]));
|
|
7213
|
+
return shownSnapshot.map((r) => live.get(r.id)).filter(Boolean);
|
|
7214
|
+
}
|
|
7215
|
+
|
|
7216
|
+
/** Is the window currently narrowing the queue at all? (Pure — unit-tested.) */
|
|
7217
|
+
function requestFilterActive(scopeAll, scope, query) {
|
|
7218
|
+
return (!scopeAll && !!scope) || !!String(query || '').trim();
|
|
7219
|
+
}
|
|
7220
|
+
|
|
7221
|
+
/**
|
|
7222
|
+
* What a bulk clear should actually do. (Pure — unit-tested, because this is the decision that
|
|
7223
|
+
* DELETES.)
|
|
7224
|
+
*
|
|
7225
|
+
* `atomic` fires `DELETE /api/requests`, which wipes the server's whole requests dir — so it is
|
|
7226
|
+
* gated on "no filter is active", NOT on "the counts happened to coincide". A count test is true
|
|
7227
|
+
* for any single-project user whose scope covers the cached queue, which would hand a filtered
|
|
7228
|
+
* clear the delete-everything verb and take out both the requests hidden behind the filter and any
|
|
7229
|
+
* knowledge-organize queued since the paint (404-ing its finish/fail and stranding its lock). The
|
|
7230
|
+
* length check is kept as a second, independent condition, so a stale snapshot also falls to the
|
|
7231
|
+
* per-id loop rather than the atomic verb.
|
|
7232
|
+
*/
|
|
7233
|
+
function bulkClearPlan(painted, all, filterActive) {
|
|
7234
|
+
const keep = painted.filter((r) => r && r.type === 'knowledge-organize');
|
|
7235
|
+
const drop = painted.filter((r) => r && r.type !== 'knowledge-organize');
|
|
7236
|
+
return { atomic: !filterActive && !keep.length && painted.length === all.length, keep, drop };
|
|
7237
|
+
}
|
|
7238
|
+
|
|
7066
7239
|
// The Requests window: every queued change in a list, each copyable + clearable,
|
|
7067
7240
|
// plus copy-all / clear-all. instructionFor() output (which embeds file-derived
|
|
7068
7241
|
// appId/nodeId/instruction) is rendered via textContent-equivalent escaping.
|
|
@@ -7070,30 +7243,77 @@
|
|
|
7070
7243
|
const $list = document.getElementById('requests-list');
|
|
7071
7244
|
const $clear = document.getElementById('requests-clear');
|
|
7072
7245
|
const $copy = document.getElementById('requests-copy');
|
|
7246
|
+
const $search = document.getElementById('requests-search');
|
|
7073
7247
|
if (!$list) return;
|
|
7074
|
-
|
|
7248
|
+
// Search is pointless over an empty queue, and over a single request it is just clutter.
|
|
7249
|
+
// Drop the query WITH the box, and before anything is filtered by it: a hidden filter still
|
|
7250
|
+
// filtering is how a list ends up inexplicably empty (the last two requests clear while a
|
|
7251
|
+
// stale query is still narrowing).
|
|
7252
|
+
if ($search) {
|
|
7253
|
+
$search.hidden = pendingRequests.length < 2;
|
|
7254
|
+
if ($search.hidden && requestQuery) { requestQuery = ''; $search.value = ''; }
|
|
7255
|
+
}
|
|
7256
|
+
const scope = activeRequestScope();
|
|
7257
|
+
const inScope = visibleRequests(pendingRequests, scope, '', requestSearchText);
|
|
7258
|
+
const shown = shownRequests();
|
|
7259
|
+
shownSnapshot = shown; // the bulk actions act on THIS paint — see the note on shownSnapshot
|
|
7260
|
+
const nothingQueued = pendingRequests.length === 0;
|
|
7261
|
+
|
|
7262
|
+
// The scope tabs only earn their space when there is something to scope TO and something
|
|
7263
|
+
// queued to scope. Counts live ON the tabs so requests hidden by the filter are never a
|
|
7264
|
+
// silent omission — "All · 7" beside "Cedar Mill Warehouse · 2" says where the rest went.
|
|
7265
|
+
const $scope = document.getElementById('requests-scope');
|
|
7266
|
+
const $here = document.getElementById('requests-scope-here');
|
|
7267
|
+
const $all = document.getElementById('requests-scope-all');
|
|
7268
|
+
if ($scope) $scope.hidden = !scope || nothingQueued;
|
|
7269
|
+
if (scope && $here && $all) {
|
|
7270
|
+
const kind = scope.kind === 'project' ? 'project' : 'workflow';
|
|
7271
|
+
// The label is the REAL name, so you can see WHICH project you're scoped to — it can
|
|
7272
|
+
// ellipsize, which is why the tip repeats it in full rather than describing it generically.
|
|
7273
|
+
$here.innerHTML = `<span class="req-scope-name">${escapeHtml(scope.label)}</span><span class="req-scope-n">· ${inScope.length}</span>`;
|
|
7274
|
+
$here.setAttribute('data-tip', `Only what's queued for the ${kind} you have open — ${scope.label}`);
|
|
7275
|
+
$all.innerHTML = `<span class="req-scope-name">All requests</span><span class="req-scope-n">· ${pendingRequests.length}</span>`;
|
|
7276
|
+
$all.setAttribute('data-tip', 'Every queued request, including other projects and workflows');
|
|
7277
|
+
$here.classList.toggle('active', !requestScopeAll);
|
|
7278
|
+
$here.setAttribute('aria-selected', String(!requestScopeAll));
|
|
7279
|
+
$all.classList.toggle('active', requestScopeAll);
|
|
7280
|
+
$all.setAttribute('aria-selected', String(requestScopeAll));
|
|
7281
|
+
}
|
|
7282
|
+
|
|
7075
7283
|
// Hide (not just disable) the bulk actions when there's nothing to act on — a
|
|
7076
|
-
// disabled "Clear all"/"Copy all" over an empty list reads as broken UI.
|
|
7077
|
-
|
|
7078
|
-
|
|
7079
|
-
|
|
7080
|
-
|
|
7284
|
+
// disabled "Clear all"/"Copy all" over an empty list reads as broken UI. They act on
|
|
7285
|
+
// what's SHOWN, so their tooltips say so rather than letting "all" quietly mean "some".
|
|
7286
|
+
const bulkTip = (verb) => (shown.length === pendingRequests.length
|
|
7287
|
+
? `${verb} all ${pendingRequests.length} queued request${pendingRequests.length === 1 ? '' : 's'}`
|
|
7288
|
+
: `${verb} the ${shown.length} request${shown.length === 1 ? '' : 's'} shown here`);
|
|
7289
|
+
if ($clear) { $clear.hidden = shown.length === 0; $clear.setAttribute('data-tip', bulkTip('Clear')); }
|
|
7290
|
+
if ($copy) { $copy.hidden = shown.length === 0; $copy.setAttribute('data-tip', bulkTip('Copy')); }
|
|
7291
|
+
|
|
7292
|
+
if (shown.length === 0) {
|
|
7293
|
+
// Three different nothings, and conflating them is what makes a filter feel broken: an
|
|
7294
|
+
// empty queue, a queue with nothing for THIS project, and a search that missed.
|
|
7295
|
+
const msg = nothingQueued
|
|
7296
|
+
? 'No requests queued. Save a Template or ✎ Tweak a node to send a change to your terminal AI.'
|
|
7297
|
+
: requestQuery.trim()
|
|
7298
|
+
? `No request matches “${escapeHtml(requestQuery.trim())}”.${!requestScopeAll && inScope.length < pendingRequests.length ? ' Try All to search every queued request.' : ''}`
|
|
7299
|
+
: `Nothing queued for ${escapeHtml(scope ? scope.label : 'this')} — ${pendingRequests.length} request${pendingRequests.length === 1 ? '' : 's'} waiting elsewhere. <button type="button" class="req-showall">Show all</button>`;
|
|
7300
|
+
$list.innerHTML = `<div class="empty-state">${msg}</div>`;
|
|
7301
|
+
const $showAll = $list.querySelector('.req-showall');
|
|
7302
|
+
if ($showAll) $showAll.onclick = () => setRequestScopeAll(true);
|
|
7081
7303
|
return;
|
|
7082
7304
|
}
|
|
7083
|
-
$list.innerHTML =
|
|
7084
|
-
const label = r
|
|
7305
|
+
$list.innerHTML = shown.map((r) => {
|
|
7306
|
+
const label = requestLabel(r);
|
|
7085
7307
|
const badgeCls = r.type === 'tweak' || r.type === 'ui-customize' || r.type === 'rebake' || r.type === 'revision-read' || r.type === 'knowledge-organize' || r.type === 'knowledge-adjust' || r.type === 'tweak-contract' ? 'req-type req-type-tweak' : 'req-type';
|
|
7086
|
-
//
|
|
7087
|
-
//
|
|
7088
|
-
//
|
|
7089
|
-
//
|
|
7090
|
-
|
|
7091
|
-
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
|
|
7095
|
-
? ` · sheet <code>${escapeHtml(r.target.sheet)}</code>`
|
|
7096
|
-
: '';
|
|
7308
|
+
// One name, and only the name. The node/input/sheet chips that used to sit here ("· node
|
|
7309
|
+
// render") are already spelled out in the instruction body right below, so they cost a line
|
|
7310
|
+
// of chrome to repeat what the sentence underneath says in English.
|
|
7311
|
+
//
|
|
7312
|
+
// The sheet chip (#629) was justified by .req-instruction's 3-line clamp: it existed because
|
|
7313
|
+
// an Ask AI note's trailing intent sentence got CLIPPED. This change replaces that clamp with
|
|
7314
|
+
// a scroller, so the whole body — intent sentence included — is readable in place and the
|
|
7315
|
+
// chip has nothing left to rescue.
|
|
7316
|
+
const owner = requestOwnerName(r);
|
|
7097
7317
|
const when = r.createdAt ? new Date(r.createdAt) : null;
|
|
7098
7318
|
const time = when && !isNaN(when) ? `<span class="req-time">${escapeHtml(nowStamp(when))}</span>` : '';
|
|
7099
7319
|
// A knowledge-organize is resolved by its own finish/fail lifecycle POST. Offering a ✕ here
|
|
@@ -7106,8 +7326,8 @@
|
|
|
7106
7326
|
return `
|
|
7107
7327
|
<div class="req-item">
|
|
7108
7328
|
<div class="req-info">
|
|
7109
|
-
<div class="req-head"><span class="${badgeCls}">${label}</span> ${
|
|
7110
|
-
<div class="req-instruction">${
|
|
7329
|
+
<div class="req-head"><span class="${badgeCls}">${label}</span> ${owner ? `<span class="req-owner">${highlightQuery(owner, requestQuery)}</span>` : ''}${time}</div>
|
|
7330
|
+
<div class="req-instruction">${highlightQuery(instructionFor(r), requestQuery) || 'This request has no instruction, so it can’t be handed to your terminal AI. Clear it and queue it again.'}</div>
|
|
7111
7331
|
${r.snapshots && r.snapshots.length ? `<div class="req-thumbs">${r.snapshots.map((sp, i) => { const pdf = /\.pdf$/i.test(String(sp)); return `<button type="button" class="req-thumb" data-id="${escapeAttr(r.id)}" data-n="${i}" aria-label="View ${pdf ? 'PDF' : 'screenshot'} ${i + 1}">${pdf ? '<span class="req-thumb-pdf">PDF</span>' : `<img src="/api/requests/${encodeURIComponent(r.id)}/snapshot/${i}" alt="">`}</button>`; }).join('')}</div>` : ''}
|
|
7112
7332
|
</div>
|
|
7113
7333
|
<div class="req-actions">
|
|
@@ -7138,29 +7358,47 @@
|
|
|
7138
7358
|
// Clear-all must never take out a knowledge-organize: the bulk DELETE would 404 its finish/fail and
|
|
7139
7359
|
// strand the organize lock until the stale timeout. The request list can't tell "queued" from
|
|
7140
7360
|
// "already started", so ALL organizes are kept — they clear themselves via their lifecycle.
|
|
7361
|
+
//
|
|
7362
|
+
// It acts on the PAINTED requests, never the whole queue and never a freshly re-derived scope.
|
|
7363
|
+
// Once the window can be scoped to one project, a "Clear all" that reached past the filter would
|
|
7364
|
+
// delete other projects' queued work the user cannot even see.
|
|
7141
7365
|
async function clearAllRequests() {
|
|
7142
|
-
|
|
7143
|
-
|
|
7366
|
+
const painted = paintedRequests();
|
|
7367
|
+
if (!painted.length) return;
|
|
7368
|
+
const filterActive = requestFilterActive(requestScopeAll, activeRequestScope(), requestQuery);
|
|
7369
|
+
const { atomic, keep, drop } = bulkClearPlan(painted, pendingRequests, filterActive);
|
|
7144
7370
|
try {
|
|
7145
|
-
if (
|
|
7146
|
-
await api('/api/requests', { method: 'DELETE' }); // nothing lifecycle-owned — the atomic bulk clear is fine
|
|
7371
|
+
if (atomic) {
|
|
7372
|
+
await api('/api/requests', { method: 'DELETE' }); // no filter, nothing lifecycle-owned — the atomic bulk clear is fine
|
|
7147
7373
|
} else {
|
|
7148
|
-
const drop = pendingRequests.filter((r) => r && r.type !== 'knowledge-organize');
|
|
7149
7374
|
for (const r of drop) await api(`/api/requests/${encodeURIComponent(r.id)}`, { method: 'DELETE' });
|
|
7150
7375
|
}
|
|
7151
7376
|
await loadRequests();
|
|
7152
7377
|
renderRequests();
|
|
7153
7378
|
showToast(
|
|
7154
7379
|
keep.length
|
|
7155
|
-
? `Cleared
|
|
7156
|
-
:
|
|
7380
|
+
? `Cleared ${drop.length} request${drop.length === 1 ? '' : 's'} — kept ${keep.length} in-progress organize${keep.length === 1 ? '' : 's'}`
|
|
7381
|
+
: atomic
|
|
7382
|
+
? 'Cleared all requests'
|
|
7383
|
+
: `Cleared ${drop.length} request${drop.length === 1 ? '' : 's'} shown here`,
|
|
7157
7384
|
'ok',
|
|
7158
7385
|
);
|
|
7159
7386
|
} catch (e) { reportErr(e); }
|
|
7160
7387
|
}
|
|
7388
|
+
// Switch the scope tab (or the empty state's "Show all") and repaint.
|
|
7389
|
+
function setRequestScopeAll(all) {
|
|
7390
|
+
requestScopeAll = !!all;
|
|
7391
|
+
renderRequests();
|
|
7392
|
+
}
|
|
7161
7393
|
// Re-fetch before showing: there is no server `request-added` broadcast, so a request queued in
|
|
7162
7394
|
// another tab (or by the Knowledge step) would otherwise render from a stale cache.
|
|
7163
7395
|
async function openRequests() {
|
|
7396
|
+
// Open on the scope + a clear search every time. A stuck "All" (or a leftover query) from a
|
|
7397
|
+
// previous visit would silently answer a different question than the one just asked.
|
|
7398
|
+
requestScopeAll = false;
|
|
7399
|
+
requestQuery = '';
|
|
7400
|
+
const $search = document.getElementById('requests-search');
|
|
7401
|
+
if ($search) $search.value = '';
|
|
7164
7402
|
document.getElementById('requests-modal').classList.add('show');
|
|
7165
7403
|
renderRequests(); // paint the cache immediately — no empty flash
|
|
7166
7404
|
await loadRequests();
|
|
@@ -8610,23 +8848,31 @@
|
|
|
8610
8848
|
if ($reqClear) $reqClear.onclick = () => clearAllRequests();
|
|
8611
8849
|
const $reqCopy = document.getElementById('requests-copy');
|
|
8612
8850
|
if ($reqCopy) $reqCopy.onclick = async () => {
|
|
8613
|
-
|
|
8851
|
+
const shown = paintedRequests(); // what was PAINTED, not a re-derived scope — see shownSnapshot
|
|
8852
|
+
if (!shown.length) return;
|
|
8614
8853
|
// Count what actually made it, not what was in the list. `.filter(Boolean)` silently drops a
|
|
8615
|
-
// request with no instruction body, and reporting
|
|
8854
|
+
// request with no instruction body, and reporting the list length over that is the
|
|
8616
8855
|
// original bug wearing a bulk hat: the user pastes, the AI applies the ones that copied, and the
|
|
8617
8856
|
// dropped request never reaches the terminal while the toast said it did.
|
|
8618
|
-
const lines =
|
|
8619
|
-
const dropped =
|
|
8857
|
+
const lines = shown.map(markedInstruction).filter(Boolean);
|
|
8858
|
+
const dropped = shown.length - lines.length;
|
|
8620
8859
|
if (!lines.length) { showToast('Nothing to copy — none of these requests has an instruction', 'err'); return; }
|
|
8621
8860
|
const copied = await copyToClipboard(lines.join('\n\n'));
|
|
8622
8861
|
if (!copied) { showToast('copy failed', 'err'); return; }
|
|
8623
8862
|
showToast(
|
|
8624
8863
|
dropped
|
|
8625
|
-
? `Copied ${lines.length} of ${
|
|
8864
|
+
? `Copied ${lines.length} of ${shown.length} — ${dropped} had no instruction and ${dropped === 1 ? 'was' : 'were'} skipped`
|
|
8626
8865
|
: `Copied ${lines.length} request(s) — paste to your terminal AI`,
|
|
8627
8866
|
dropped ? 'warn' : 'ok',
|
|
8628
8867
|
);
|
|
8629
8868
|
};
|
|
8869
|
+
const $reqScope = document.getElementById('requests-scope');
|
|
8870
|
+
if ($reqScope) $reqScope.onclick = (e) => {
|
|
8871
|
+
const b = e.target.closest('button[data-reqscope]');
|
|
8872
|
+
if (b) setRequestScopeAll(b.dataset.reqscope === 'all');
|
|
8873
|
+
};
|
|
8874
|
+
const $reqSearch = document.getElementById('requests-search');
|
|
8875
|
+
if ($reqSearch) $reqSearch.oninput = () => { requestQuery = $reqSearch.value; renderRequests(); };
|
|
8630
8876
|
const $requestHelpModal = document.getElementById('request-help-modal');
|
|
8631
8877
|
const $requestHelpOpen = document.getElementById('request-help-open');
|
|
8632
8878
|
const $requestHelpKeep = document.getElementById('request-help-keep');
|
|
@@ -8843,6 +9089,23 @@
|
|
|
8843
9089
|
},
|
|
8844
9090
|
// Refresh the footer requests counter after the Customize box queues a request.
|
|
8845
9091
|
loadRequests,
|
|
9092
|
+
// Which project the Requests window filters to. workspaces.js owns the open project;
|
|
9093
|
+
// aware.js owns the window. Called from applyMode() — the single funnel every path that
|
|
9094
|
+
// changes the open project (open, close, rename, mode switch, boot) already ends at.
|
|
9095
|
+
//
|
|
9096
|
+
// THREE states, not two, and collapsing the last two is a bug: an open project scopes to it;
|
|
9097
|
+
// the Workspaces LANDING has no scope and must not borrow the open workflow's; Workflows mode
|
|
9098
|
+
// passes null and lets aware.js scope to the open workflow. Pass `{}` (or anything without a
|
|
9099
|
+
// project) for the landing, `null` for Workflows mode.
|
|
9100
|
+
//
|
|
9101
|
+
// Repaints an already-open window so switching underneath it can't leave a stale scope on screen.
|
|
9102
|
+
setRequestScope(scope) {
|
|
9103
|
+
wsRequestScope = scope
|
|
9104
|
+
? (scope.project ? { kind: 'project', ...scope } : { kind: 'none' })
|
|
9105
|
+
: null;
|
|
9106
|
+
const $rm = document.getElementById('requests-modal');
|
|
9107
|
+
if ($rm && $rm.classList.contains('show')) renderRequests();
|
|
9108
|
+
},
|
|
8846
9109
|
refreshCurrentWorkflow() {
|
|
8847
9110
|
return refreshCurrentWorkflowAvailability();
|
|
8848
9111
|
},
|
package/dist/web/index.html
CHANGED
|
@@ -33,12 +33,16 @@
|
|
|
33
33
|
</span>
|
|
34
34
|
<span class="name">FloLess</span>
|
|
35
35
|
</div>
|
|
36
|
-
<!-- Top-level mode switch (
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
<!-- Top-level mode switch (Workspaces = project/document apps, no Run; Workflows = node
|
|
37
|
+
canvas + Run). Segmented control, Ctrl+1/Ctrl+2 — the shortcuts follow POSITION, so
|
|
38
|
+
they swap with the tabs (#623). See docs/superpowers/specs/
|
|
39
|
+
2026-07-03-workspaces-two-mode-shell-design.md.
|
|
40
|
+
Workspaces leads because it is the primary entry point (#623); which mode the app
|
|
41
|
+
OPENS in is unchanged — that is the remembered `floless:mode`, defaulting to
|
|
42
|
+
Workflows. -->
|
|
39
43
|
<div class="mode-switch" id="mode-switch" role="tablist" aria-label="Mode">
|
|
40
|
-
<button type="button" data-mode="workflows" class="active" role="tab" aria-selected="true">Workflows</button>
|
|
41
44
|
<button type="button" data-mode="workspaces" role="tab" aria-selected="false">Workspaces</button>
|
|
45
|
+
<button type="button" data-mode="workflows" class="active" role="tab" aria-selected="true">Workflows</button>
|
|
42
46
|
</div>
|
|
43
47
|
<!-- Workspace view switch (Canvas = the workflow topology; Dashboard = the user's
|
|
44
48
|
custom panels from ~/.floless/ui/extensions.json) moved into the ≡ menu in #149.
|
|
@@ -741,6 +745,14 @@
|
|
|
741
745
|
<div class="modal requests">
|
|
742
746
|
<div class="modal-title">Requests for your terminal AI</div>
|
|
743
747
|
<div class="modal-sub">The UI can’t edit workflows itself — these are the changes it queued for your terminal AI (Claude Code / Codex / OpenCode) to apply. Copy one to paste, or clear ones already handled.</div>
|
|
748
|
+
<!-- Scope + search. The scope row is hidden when nothing is open to scope TO (the
|
|
749
|
+
Workspaces landing, or Workflows with no workflow selected) — a filter with one
|
|
750
|
+
possible answer is noise. Labels/counts are written per-render in aware.js. -->
|
|
751
|
+
<div class="tabs req-scope" id="requests-scope" role="tablist" aria-label="Filter requests by what you have open" hidden>
|
|
752
|
+
<button type="button" data-reqscope="scoped" class="active" role="tab" aria-selected="true" id="requests-scope-here"></button>
|
|
753
|
+
<button type="button" data-reqscope="all" role="tab" aria-selected="false" id="requests-scope-all">All</button>
|
|
754
|
+
</div>
|
|
755
|
+
<input id="requests-search" class="lib-search req-search" type="text" placeholder="Search by project, workflow, or what you asked for" aria-label="Search requests">
|
|
744
756
|
<div class="requests-list" id="requests-list"></div>
|
|
745
757
|
<div class="modal-actions">
|
|
746
758
|
<button id="requests-clear">Clear all</button>
|