@floless/app 0.126.4 → 0.126.5
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 +806 -335
- package/dist/skills/floless-app-new-workflow/SKILL.md +18 -1
- package/dist/skills/floless-app-workflows/SKILL.md +20 -1
- package/dist/web/app.css +65 -14
- package/dist/web/aware.js +129 -2
- package/dist/web/index.html +12 -0
- package/dist/web/workspaces.js +24 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: floless-app-new-workflow
|
|
3
3
|
description: This skill should be used to build a brand-new FloLess .flo workflow from scratch, step by step, as the host terminal AI — interviewing the user about what they want, checking that the AWARE agents the workflow needs are installed (installing an available one on consent, or reporting a not-yet-existing agent as an idea), then authoring the .flo node by node and verifying each step with the real toolchain (plain-English descriptions, aware app validate, aware app compile, a real run) before installing it so it appears in the floless.app picker for Compile and Run. Use it on triggers like "build a new workflow", "create a workflow from scratch", "build me a workflow", "new workflow", the floless.app "New workflow…" menu item, a queued new-workflow request, or "/floless-app-new-workflow". It leans on floless-app-workflows for the exec contract and hands back a runnable, approved app.
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.
|
|
5
|
+
version: 0.3.0
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Build a new floless.app workflow from scratch
|
|
@@ -91,6 +91,23 @@ user's practice — a plausible bolt spacing rather than *their* bolt spacing.
|
|
|
91
91
|
3. **Bake what it says in as literal values, and cite the page** in the node's plain-English
|
|
92
92
|
Description — e.g. "Spacing per `shop-standard-bolts`." That is what makes the decision traceable
|
|
93
93
|
to the firm's own document instead of looking like your preference.
|
|
94
|
+
4. **Record what you built from**, once the workflow is installed and has an `<appId>`:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
PUT <base>/api/kb-pin/<appId>
|
|
98
|
+
{ "projectId": "<project>",
|
|
99
|
+
"generationId": "<the generation.generationId the feed returned>",
|
|
100
|
+
"pages": [{ "slug": "shop-standard-bolts", "title": "Shop Standard Bolts" }] }
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Only the pages you actually relied on (at most 20). The app renders this as "Informed by …" and
|
|
104
|
+
tells the user when that knowledge has changed since.
|
|
105
|
+
|
|
106
|
+
**Send the generation id you READ, not whatever is current when you finish.** If the knowledge
|
|
107
|
+
base is re-organized mid-build, the generation you actually read is still the right thing to
|
|
108
|
+
record and the route accepts it — this is a record of what the workflow was built from, not a
|
|
109
|
+
claim about what is current. Pinning "the latest" instead would record a generation whose
|
|
110
|
+
contents never touched your work.
|
|
94
111
|
|
|
95
112
|
`hasKnowledge: true` only means a knowledge base was published, not that it covers your subject. If
|
|
96
113
|
nothing relevant comes back, **say so and proceed on stated assumptions** — never invent a standard.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: floless-app-workflows
|
|
3
3
|
description: This skill should be used when building, modifying, or reasoning about FloLess .flo workflows for floless.app — especially reusable apps that take inputs (e.g. a phase number) and run across different Tekla models, exec nodes that run Roslyn C# against the live model, the in-app HTML Viewer, the Code tab, or "Debug in VS". Covers the exec contract, the install→validate→compile→run loop, app inputs templating, reading an approved Workspace project's data from a running workflow via the floless-workspace REST seam plus its workspace-project input picker, and the server seams (aware-adapter, app-reader, index).
|
|
4
4
|
metadata:
|
|
5
|
-
version: 0.
|
|
5
|
+
version: 0.5.0
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Building reusable .flo workflows in floless.app
|
|
@@ -342,6 +342,25 @@ When work is tied to a Workspace project (the user names one, or a queued reques
|
|
|
342
342
|
3. **Bake what it says in as literal values and cite the page** in the node's plain-English
|
|
343
343
|
Description ("Spacing per `shop-standard-bolts`"), so the choice is traceable to the firm's
|
|
344
344
|
document rather than to you. If nothing relevant matches, say so — never invent a standard.
|
|
345
|
+
4. **Record what you built from**, so the app can show it and can warn the user when that knowledge
|
|
346
|
+
later changes:
|
|
347
|
+
|
|
348
|
+
```
|
|
349
|
+
PUT <base>/api/kb-pin/<appId>
|
|
350
|
+
{ "projectId": "<project>",
|
|
351
|
+
"generationId": "<the generation.generationId the feed returned>",
|
|
352
|
+
"pages": [{ "slug": "shop-standard-bolts", "title": "Shop Standard Bolts" }] }
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
Only the pages you actually relied on (at most 20). Consulting the KB and finding nothing
|
|
356
|
+
relevant is a normal outcome — skip the pin rather than recording an empty list.
|
|
357
|
+
|
|
358
|
+
**Send the generation id you READ, not whatever is current when you finish.** If an Organize pass
|
|
359
|
+
republishes the knowledge base while you are working, the generation you actually read is still
|
|
360
|
+
the correct thing to record, and the route accepts it — the pin is a record of what this workflow
|
|
361
|
+
was built from, not a claim about what is current. The app compares the two itself and tells the
|
|
362
|
+
user when they have diverged. Re-reading the feed to "pin the latest" would record a generation
|
|
363
|
+
whose contents never touched your work, which is the one failure this record exists to prevent.
|
|
345
364
|
|
|
346
365
|
Compose time only: what you learn is baked into the `.flo`. A model in the run path is refused by
|
|
347
366
|
AWARE (`E_APP_RUNTIME_MODEL_FORBIDDEN`) and would void "build once, run forever" — **outside the one
|
package/dist/web/app.css
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
/* Block 1: base tokens + full component styling */
|
|
3
3
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
4
4
|
|
|
5
|
+
/* The semantic hidden state must win over every component display declaration.
|
|
6
|
+
Components restore their intended layout by removing the attribute. */
|
|
7
|
+
[hidden] { display: none !important; }
|
|
8
|
+
|
|
5
9
|
:root {
|
|
6
10
|
--bg: #070a0f;
|
|
7
11
|
--surface: #0f141c;
|
|
@@ -472,7 +476,8 @@
|
|
|
472
476
|
/* fav-bar is already opaque (surface); the notes pill stays translucent by design
|
|
473
477
|
— both just need to paint ABOVE the panned content (the notes stay readable). */
|
|
474
478
|
.canvas > .fav-bar,
|
|
475
|
-
.canvas > .notes-strip
|
|
479
|
+
.canvas > .notes-strip,
|
|
480
|
+
.canvas > .kb-informed { position: relative; z-index: 6; }
|
|
476
481
|
|
|
477
482
|
/* LINEAR */
|
|
478
483
|
.topology:not(.dag) .agent-card { flex: 0 0 210px; }
|
|
@@ -1574,6 +1579,12 @@
|
|
|
1574
1579
|
.lib-update:hover { color: var(--accent); border-color: var(--accent); }
|
|
1575
1580
|
.lib-update[aria-busy="true"] { color: var(--text-dim); border-color: var(--border-strong); cursor: default; pointer-events: none; }
|
|
1576
1581
|
.lib-update .rtn-spinner { width: 11px; height: 11px; border-width: 2px; }
|
|
1582
|
+
/* A background update can finish long after its initiating click. Keep its reason
|
|
1583
|
+
with that agent card, using the existing compact slate surface and a restrained
|
|
1584
|
+
error edge rather than making a transient toast carry essential information. */
|
|
1585
|
+
.lib-update-error { margin: 4px 0 0; padding: 7px 10px; border-left: 2px solid var(--err);
|
|
1586
|
+
background: var(--surface-2); color: var(--text-muted); font-size: 11px; line-height: 1.45; }
|
|
1587
|
+
.lib-update-error strong { color: var(--err); font-weight: 600; }
|
|
1577
1588
|
|
|
1578
1589
|
/* Two-tab Agent Library: the tab bar sits between title and panes; each pane is a
|
|
1579
1590
|
flex column so its inner .lib-list keeps scrolling within the modal's max-height.
|
|
@@ -1803,10 +1814,8 @@
|
|
|
1803
1814
|
Warehouse"), and uppercasing those misreads them. Long names ellipsize; the full name
|
|
1804
1815
|
is on the tab's data-tip. */
|
|
1805
1816
|
.req-scope { margin: 2px 0 12px; }
|
|
1806
|
-
/*
|
|
1807
|
-
|
|
1808
|
-
markup — a blank first tab and the literal "All" placeholder from index.html — whenever there
|
|
1809
|
-
was no scope to name (the Workspaces landing, or no workflow open). */
|
|
1817
|
+
/* Component-local backstop for the scope tabs; the base `[hidden]` invariant
|
|
1818
|
+
above is the authoritative semantic hide rule. */
|
|
1810
1819
|
.req-scope[hidden] { display: none; }
|
|
1811
1820
|
/* The tab is a flex row, NOT one ellipsizing line, because the count is the trailing child:
|
|
1812
1821
|
`text-overflow: ellipsis` clips the END, so a long project name would truncate away the very
|
|
@@ -1993,14 +2002,8 @@
|
|
|
1993
2002
|
/* The split: ▶ runs with the current default, ▾ opens the options form. Two buttons sharing one
|
|
1994
2003
|
silhouette via joined radii — a real menu popover would need outside-click, focus trapping and
|
|
1995
2004
|
its own scroll container for two decisions a themed form already asks better. */
|
|
1996
|
-
/*
|
|
1997
|
-
|
|
1998
|
-
is a NO-OP: the queued-request modal's one caller queues a `revision-read`, which the run
|
|
1999
|
-
policy refuses, so "▶ Run it for me" painted on the one surface it could never work from —
|
|
2000
|
-
worse than a disabled control, because it looks live. `.request-help-steps` is pre-existing
|
|
2001
|
-
but only became a TOGGLED element in this change, and it is the other half: without it the
|
|
2002
|
-
modal shows "Paste the copied instructions" beside "Running in Claude Code". Found by review,
|
|
2003
|
-
invisible to any assertion that reads `.hidden` rather than computed style. */
|
|
2005
|
+
/* Component-local backstops retained for the request-help state machine; the
|
|
2006
|
+
base `[hidden]` invariant above protects every future display declaration too. */
|
|
2004
2007
|
.run-split[hidden],
|
|
2005
2008
|
.request-help-run-status[hidden],
|
|
2006
2009
|
.request-help-steps[hidden] { display: none; }
|
|
@@ -3141,6 +3144,54 @@ body {
|
|
|
3141
3144
|
/* Collapsed → faint single line; the whole row re-expands on click. */
|
|
3142
3145
|
.notes-strip.collapsed { background: transparent; border-color: color-mix(in srgb, var(--info) 18%, transparent); cursor: pointer; }
|
|
3143
3146
|
.notes-strip.collapsed ul { display: none; }
|
|
3147
|
+
|
|
3148
|
+
/* "Informed by …" — which of the firm's own knowledge built this workflow.
|
|
3149
|
+
Box model borrowed from .notes-strip above (same margin/padding/radius, so the two stack as one
|
|
3150
|
+
family) but NEUTRAL, not info-tinted: the notes strip's blue/amber/red ladder means "the compiler
|
|
3151
|
+
has something to say about your nodes", and wearing that costume would make provenance read as a
|
|
3152
|
+
compiler warning about the topology. This is quiet baseline metadata. */
|
|
3153
|
+
.kb-informed {
|
|
3154
|
+
margin: 8px 12px 0;
|
|
3155
|
+
padding: 6px 12px;
|
|
3156
|
+
border: 1px solid var(--border-strong);
|
|
3157
|
+
background: var(--surface-2);
|
|
3158
|
+
border-radius: 6px;
|
|
3159
|
+
color: var(--text-muted);
|
|
3160
|
+
font-size: 12px;
|
|
3161
|
+
line-height: 1.6;
|
|
3162
|
+
/* Wraps rather than scrolls. A pin cites a handful of pages in practice (20 is the store's hard
|
|
3163
|
+
cap, not the shape), so a scroll container would be chrome for a case that does not happen. */
|
|
3164
|
+
display: flex;
|
|
3165
|
+
flex-wrap: wrap;
|
|
3166
|
+
align-items: center;
|
|
3167
|
+
gap: 6px 10px;
|
|
3168
|
+
}
|
|
3169
|
+
.kb-informed[hidden] { display: none; } /* the flex display would otherwise defeat [hidden] */
|
|
3170
|
+
.kb-informed-label { color: var(--text-dim); flex: none; }
|
|
3171
|
+
.kb-informed-pages { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
|
|
3172
|
+
/* A real <button>, so the global button:focus-visible ring already covers keyboard focus. */
|
|
3173
|
+
.kb-page-link {
|
|
3174
|
+
background: none; border: none; padding: 0;
|
|
3175
|
+
font: inherit; color: var(--accent); cursor: pointer;
|
|
3176
|
+
display: inline-flex; align-items: baseline; gap: 3px;
|
|
3177
|
+
}
|
|
3178
|
+
.kb-page-link:hover { color: var(--accent-bright, var(--accent)); text-decoration: underline; }
|
|
3179
|
+
.kb-page-link .kb-page-ico { font-size: 10px; opacity: 0.7; }
|
|
3180
|
+
.kb-informed-sep { color: var(--text-dim); }
|
|
3181
|
+
/* Mirrors .wf-forked-pill's recipe exactly: amber, informational, not a fault. Sits over the canvas,
|
|
3182
|
+
a panel away from the header's run-state pill, so the two ambers never read as one state. */
|
|
3183
|
+
.kb-drift-chip {
|
|
3184
|
+
border: 1px solid var(--warn);
|
|
3185
|
+
background: rgba(251, 191, 36, 0.08);
|
|
3186
|
+
color: var(--warn);
|
|
3187
|
+
font-size: 10px;
|
|
3188
|
+
padding: 1px 8px;
|
|
3189
|
+
border-radius: 999px;
|
|
3190
|
+
line-height: 1.5;
|
|
3191
|
+
white-space: nowrap;
|
|
3192
|
+
cursor: default;
|
|
3193
|
+
}
|
|
3194
|
+
.kb-drift-chip:not([hidden]) { display: inline-flex; align-items: center; }
|
|
3144
3195
|
.notes-strip.collapsed .notes-head { color: var(--text-dim); margin-bottom: 0; }
|
|
3145
3196
|
.notes-strip.collapsed .notes-dismiss { display: none; }
|
|
3146
3197
|
.notes-strip.collapsed .notes-title::after { content: " — show"; color: var(--text-dim); font-weight: 400; }
|
|
@@ -4090,7 +4141,7 @@ body.mode-workspaces #menu .menu-item[data-action="graft"],
|
|
|
4090
4141
|
body.mode-workspaces #menu .menu-item[data-action="bake"] { display:none; }
|
|
4091
4142
|
.app.mode-workspaces .topology, .app.mode-workspaces .canvas-toolbar,
|
|
4092
4143
|
.app.mode-workspaces .hint, .app.mode-workspaces .fav-bar, .app.mode-workspaces .dashboard,
|
|
4093
|
-
.app.mode-workspaces .notes-strip, .app.mode-workspaces .find-overlay,
|
|
4144
|
+
.app.mode-workspaces .notes-strip, .app.mode-workspaces .kb-informed, .app.mode-workspaces .find-overlay,
|
|
4094
4145
|
.app.mode-workspaces #canvas-drop-target, .app.mode-workspaces #wf-templates-stats,
|
|
4095
4146
|
/* the ws surfaces carry their own headings — hide the canvas's "Canvas · transparency layer" label */
|
|
4096
4147
|
.app.mode-workspaces .canvas > .panel-label { display:none !important; }
|
package/dist/web/aware.js
CHANGED
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
const $simBtn = document.getElementById('sim-btn');
|
|
17
17
|
const $runState = document.getElementById('run-state');
|
|
18
18
|
const $notesStrip = document.getElementById('notes-strip');
|
|
19
|
+
const $kbInformed = document.getElementById('kb-informed');
|
|
20
|
+
const $kbInformedPages = document.getElementById('kb-informed-pages');
|
|
21
|
+
const $kbDriftChip = document.getElementById('kb-drift-chip');
|
|
19
22
|
const $reportModal = document.getElementById('report-modal');
|
|
20
23
|
const $reportFrame = document.getElementById('report-frame');
|
|
21
24
|
const $reportFrame3d = document.getElementById('report-frame-3d');
|
|
@@ -627,6 +630,72 @@
|
|
|
627
630
|
}
|
|
628
631
|
}
|
|
629
632
|
|
|
633
|
+
// ── "Informed by" — which knowledge built this workflow ────────────────────
|
|
634
|
+
//
|
|
635
|
+
// WORKFLOW-LEVEL, not per node. The pin the server keeps is app-scoped — a project, a knowledge
|
|
636
|
+
// generation, and the pages that were cited — with no node granularity, so rendering it under each
|
|
637
|
+
// node's Description would repeat one identical list down the Inspect panel while implying each
|
|
638
|
+
// node had its own sources. Attribution that fine needs the AI to report which page informed which
|
|
639
|
+
// node, which is a different record than the one that exists. (Decided with Pawel, 2026-08-10.)
|
|
640
|
+
//
|
|
641
|
+
// Never blocks Run, and that is deliberate: the determinism gate is the `.flo`↔`.lock` pair, and
|
|
642
|
+
// treating stale knowledge as the same class of problem would make a workflow that runs perfectly
|
|
643
|
+
// well look broken. Say it, don't block it.
|
|
644
|
+
let kbPinRead = 0;
|
|
645
|
+
|
|
646
|
+
/** Paint the strip, or hide it outright. No pin → nothing at all: not a disabled control, not an
|
|
647
|
+
* "unknown" row. Most workflows were never built against a knowledge base, and that is ordinary. */
|
|
648
|
+
function paintKbInformed(pin, drift) {
|
|
649
|
+
if (!$kbInformed) return;
|
|
650
|
+
if (!pin || !pin.pages || !pin.pages.length) {
|
|
651
|
+
$kbInformed.hidden = true;
|
|
652
|
+
$kbInformedPages.innerHTML = '';
|
|
653
|
+
delete $kbInformed.dataset.kbProject;
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
// The pin's own project, so the click handler opens the KB that actually informed this workflow
|
|
657
|
+
// rather than whichever project Workspaces happens to have open.
|
|
658
|
+
$kbInformed.dataset.kbProject = String(pin.projectId || '');
|
|
659
|
+
// Every value here is file-derived (a wiki page's own slug and title) and lands in innerHTML, so
|
|
660
|
+
// it is escaped exactly like the node/agent strings in buildAgentEntry above.
|
|
661
|
+
$kbInformedPages.innerHTML = pin.pages.map((pg, i) => {
|
|
662
|
+
const slug = String(pg.slug || '');
|
|
663
|
+
// The TITLE reads as a sentence; the slug reads as a filename. The slug still rides the tooltip
|
|
664
|
+
// so a user can trace the citation back to the page as the KB names it. `|| slug` rather than a
|
|
665
|
+
// humanizer: a title is always present in a well-formed pin, and inventing prose from a slug
|
|
666
|
+
// would be guessing at the one place this feature must not guess.
|
|
667
|
+
const label = String(pg.title || slug);
|
|
668
|
+
const sep = i ? '<span class="kb-informed-sep">·</span>' : '';
|
|
669
|
+
return `${sep}<button type="button" class="kb-page-link" data-kb-slug="${escapeAttr(slug)}"`
|
|
670
|
+
+ ` data-tip="Open “${escapeAttr(label)}” (${escapeAttr(slug)}) in the Knowledge Base"`
|
|
671
|
+
// The visible label alone does not say this leaves Workflows, and `data-tip` is a purely
|
|
672
|
+
// VISUAL tooltip (web/app.js wires no aria-describedby), so the full action goes in an
|
|
673
|
+
// aria-label or a screen-reader user loses it entirely.
|
|
674
|
+
+ ` aria-label="Open ${escapeAttr(label)} in the Knowledge Base">`
|
|
675
|
+
+ `<span class="kb-page-ico" aria-hidden="true">↗</span>${escapeHtml(label)}</button>`;
|
|
676
|
+
}).join('');
|
|
677
|
+
$kbDriftChip.hidden = !drift;
|
|
678
|
+
$kbInformed.hidden = false;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
/** Read the pin for `id`. Guarded by a read counter, not by the response: the user can switch
|
|
682
|
+
* workflows while this is in flight, and a late answer must never paint another workflow's
|
|
683
|
+
* provenance over the one now on screen. A failed read hides the strip rather than guessing. */
|
|
684
|
+
async function refreshKbInformed(id) {
|
|
685
|
+
const read = ++kbPinRead;
|
|
686
|
+
paintKbInformed(null, false); // clear the previous workflow's row before the await, not after
|
|
687
|
+
if (!id) return;
|
|
688
|
+
try {
|
|
689
|
+
const r = await fetch(`/api/kb-pin/${encodeURIComponent(id)}`, { cache: 'no-store' });
|
|
690
|
+
const d = await r.json();
|
|
691
|
+
if (read !== kbPinRead || currentId !== id) return; // superseded — a newer workflow owns the strip
|
|
692
|
+
if (r.ok && d.ok) paintKbInformed(d.pin, !!d.drift);
|
|
693
|
+
} catch {
|
|
694
|
+
/* Offline or a route that isn't there: provenance is additive, so its absence is not an error
|
|
695
|
+
the user needs told about. The strip stays hidden, cleared above. */
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
630
699
|
function paintModes() {
|
|
631
700
|
document.querySelectorAll('.agent-card').forEach((card) => {
|
|
632
701
|
const a = AGENTS[card.dataset.agentId];
|
|
@@ -997,6 +1066,7 @@
|
|
|
997
1066
|
seedAppInputs(app);
|
|
998
1067
|
markSpecialNodes();
|
|
999
1068
|
paintGate(app);
|
|
1069
|
+
refreshKbInformed(id); // detached: provenance is additive, and must not hold up the canvas paint
|
|
1000
1070
|
paintBeacon(app); // pulse "Start here" while this workflow is new to the user
|
|
1001
1071
|
refreshDirtyIndicator(); // clean app → dot off; switched back to a dirty one → dot on
|
|
1002
1072
|
renderWfUpdatePill(); // show the "↑ Update to vX" pill when THIS app has a newer published version
|
|
@@ -1033,6 +1103,18 @@
|
|
|
1033
1103
|
return waitForPublicationAvailabilityIdle();
|
|
1034
1104
|
}
|
|
1035
1105
|
|
|
1106
|
+
// Workspaces keeps the existing workflow selected underneath its project surface. Returning to
|
|
1107
|
+
// Workflows is therefore a re-open of that workflow: refresh both its publication state and the
|
|
1108
|
+
// additive provenance strip, so a KB organize that happened while the project was open cannot
|
|
1109
|
+
// leave a stale "Informed by" answer on the canvas.
|
|
1110
|
+
function refreshCurrentWorkflow() {
|
|
1111
|
+
const id = currentId;
|
|
1112
|
+
return Promise.all([
|
|
1113
|
+
refreshCurrentWorkflowAvailability(),
|
|
1114
|
+
refreshKbInformed(id),
|
|
1115
|
+
]).then(() => {});
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1036
1118
|
async function loadApps() {
|
|
1037
1119
|
// …and mean it: the trigger said "loading…" but stayed CLICKABLE, so a click during the fetch
|
|
1038
1120
|
// opened the popover onto an empty #wf-list — the exact "picker opens and stays empty, it never
|
|
@@ -1060,6 +1142,8 @@
|
|
|
1060
1142
|
// don't also raise the warn-coloured notes strip (it's for real compiler
|
|
1061
1143
|
// notes, and a yellow band for a neutral first-run reads as a false alarm).
|
|
1062
1144
|
$notesStrip.hidden = true;
|
|
1145
|
+
currentId = null;
|
|
1146
|
+
refreshKbInformed(null); // invalidate any in-flight app read and remove workflow-only provenance
|
|
1063
1147
|
$runBtn.disabled = true;
|
|
1064
1148
|
$compileBtn.disabled = true;
|
|
1065
1149
|
if ($menuBakeItem) $menuBakeItem.disabled = true;
|
|
@@ -6506,6 +6590,10 @@
|
|
|
6506
6590
|
if (typeof m.appId !== 'string' || m.appId === currentId) {
|
|
6507
6591
|
refreshCurrentWorkflowAvailability().catch(reportErr);
|
|
6508
6592
|
}
|
|
6593
|
+
} else if (m.type === 'kb-pin-changed' && m.id === currentId && !inWorkspacesMode()) {
|
|
6594
|
+
// The event is only an invalidation. Re-read the workflow-scoped pin so the server remains
|
|
6595
|
+
// the source of truth; refresh clears first and its epoch rejects any older response.
|
|
6596
|
+
refreshKbInformed(currentId);
|
|
6509
6597
|
} else if (m.type === 'trace' && m.id === currentId) {
|
|
6510
6598
|
pushTrace(m.event);
|
|
6511
6599
|
if (state.currentTab === 'execution') renderInspect();
|
|
@@ -6548,6 +6636,7 @@
|
|
|
6548
6636
|
const isUpdate = m.action === 'update';
|
|
6549
6637
|
installingIds.delete(m.id);
|
|
6550
6638
|
if (m.ok) {
|
|
6639
|
+
if (isUpdate) agentUpdateFailures.delete(m.id);
|
|
6551
6640
|
if (isUpdate) {
|
|
6552
6641
|
showToast(`Updated “${m.id}”`, 'ok');
|
|
6553
6642
|
} else {
|
|
@@ -6587,7 +6676,12 @@
|
|
|
6587
6676
|
importFailedOfferRetry();
|
|
6588
6677
|
});
|
|
6589
6678
|
} else {
|
|
6590
|
-
|
|
6679
|
+
if (isUpdate) {
|
|
6680
|
+
agentUpdateFailures.set(m.id, String(m.error || `Could not update ${m.id}.`));
|
|
6681
|
+
showToast(`Could not update ${m.id} — see the card for details.`, 'err');
|
|
6682
|
+
} else {
|
|
6683
|
+
showToast(`Could not install ${m.id}: ${String(m.error || '').slice(0, 120)}`, 'err');
|
|
6684
|
+
}
|
|
6591
6685
|
if (_importFailedVersions.has(m.id)) {
|
|
6592
6686
|
// A failed update is NOT the "nothing to update" answer — say which it was, and re-arm the
|
|
6593
6687
|
// row's own button so the user can try that one again without redoing the others.
|
|
@@ -7774,6 +7868,10 @@
|
|
|
7774
7868
|
// not disabled, when up to date. A pull in flight shows a spinner instead.
|
|
7775
7869
|
const latest = availableLoaded ? latestVersionFor(a.id) : null;
|
|
7776
7870
|
const canUpdate = !!latest && cmpVer(latest, a.version) > 0;
|
|
7871
|
+
const failure = agentUpdateFailures.get(a.id);
|
|
7872
|
+
const failureHtml = failure
|
|
7873
|
+
? `<p class="lib-update-error"><strong>Update stopped.</strong> ${escapeHtml(failure)} <button class="lib-update" data-update="${id}" aria-label="Retry update for ${id}" data-tip="Retry update for ${id}">Retry</button></p>`
|
|
7874
|
+
: '';
|
|
7777
7875
|
const updateBtn = installingIds.has(a.id)
|
|
7778
7876
|
? `<button class="lib-update" aria-busy="true" aria-label="Updating ${escapeAttr(a.id)}…" data-tip="Downloading update from the registry — this can take a minute"><span class="rtn-spinner"></span></button>`
|
|
7779
7877
|
: canUpdate
|
|
@@ -7791,6 +7889,7 @@
|
|
|
7791
7889
|
<button class="lib-fav" data-expand="${id}" data-tip="Show commands">⌄</button>
|
|
7792
7890
|
</div>
|
|
7793
7891
|
</div>
|
|
7892
|
+
${failureHtml}
|
|
7794
7893
|
<div class="lib-commands" id="cmds-${id}" hidden></div>
|
|
7795
7894
|
</div>`;
|
|
7796
7895
|
}).join('') || '<div class="empty-state">No agents match.</div>';
|
|
@@ -7870,6 +7969,10 @@
|
|
|
7870
7969
|
let availableUnsupported = false; // CLI too old to know `agent catalog`
|
|
7871
7970
|
let libTab = 'installed';
|
|
7872
7971
|
const installingIds = new Set(); // ids with an install in flight (server runs it async)
|
|
7972
|
+
// A failed background update must stay visible on its originating card after
|
|
7973
|
+
// renderLibrary() restores the button. A toast alone disappears before someone
|
|
7974
|
+
// can read the reason or decide whether retrying is appropriate.
|
|
7975
|
+
const agentUpdateFailures = new Map(); // id -> safe, user-facing failure reason
|
|
7873
7976
|
|
|
7874
7977
|
async function loadAvailableAgents() {
|
|
7875
7978
|
const { agents, unsupported } = await api('/api/agents/available');
|
|
@@ -8010,6 +8113,8 @@
|
|
|
8010
8113
|
function updateAgent(id, btn, onStartError) {
|
|
8011
8114
|
if (installingIds.has(id)) return; // already in flight (server dedupes too)
|
|
8012
8115
|
installingIds.add(id);
|
|
8116
|
+
agentUpdateFailures.delete(id);
|
|
8117
|
+
if ($libModal && $libModal.classList.contains('show') && libTab === 'installed') renderLibrary();
|
|
8013
8118
|
if (btn) { // immediate feedback before the next render
|
|
8014
8119
|
btn.setAttribute('aria-busy', 'true');
|
|
8015
8120
|
btn.setAttribute('aria-label', `Updating ${id}…`);
|
|
@@ -9213,6 +9318,23 @@
|
|
|
9213
9318
|
if (id && sig) saveNotesCollapsed(id, sig, $notesStrip.classList.contains('collapsed'));
|
|
9214
9319
|
});
|
|
9215
9320
|
|
|
9321
|
+
// "Informed by" → open that page in the Knowledge Base. Delegated, since the row is rebuilt on
|
|
9322
|
+
// every workflow open. The viewer lives in workspaces.js's own closure, so this hands off through
|
|
9323
|
+
// the one seam it publishes — and degrades to a toast if that seam is absent, because the two files
|
|
9324
|
+
// are separate IIFEs and nothing guarantees load order at this callsite.
|
|
9325
|
+
if ($kbInformedPages) $kbInformedPages.addEventListener('click', (e) => {
|
|
9326
|
+
const btn = e.target.closest('[data-kb-slug]');
|
|
9327
|
+
if (!btn) return;
|
|
9328
|
+
const ws = window.flolessWorkspaces;
|
|
9329
|
+
if (!ws || typeof ws.openKnowledgePage !== 'function') {
|
|
9330
|
+
showToast('Open the project’s Knowledge step to read this page.', 'warn');
|
|
9331
|
+
return;
|
|
9332
|
+
}
|
|
9333
|
+
// The pin's OWN projectId, stashed on the row when it was painted — never a guess about which
|
|
9334
|
+
// project is "current" in the other mode.
|
|
9335
|
+
ws.openKnowledgePage($kbInformed.dataset.kbProject, btn.dataset.kbSlug);
|
|
9336
|
+
});
|
|
9337
|
+
|
|
9216
9338
|
// Take over the menu/keyboard Save from app.js's demo stub: in the real app the
|
|
9217
9339
|
// UI can't author the .flo (that's the terminal AI's job), so "Save" persists the
|
|
9218
9340
|
// current workflow's input values locally. "Save to…" (demo .flo download) is
|
|
@@ -9516,7 +9638,12 @@
|
|
|
9516
9638
|
if ($rm && $rm.classList.contains('show')) renderRequests();
|
|
9517
9639
|
},
|
|
9518
9640
|
refreshCurrentWorkflow() {
|
|
9519
|
-
return
|
|
9641
|
+
return refreshCurrentWorkflow();
|
|
9642
|
+
},
|
|
9643
|
+
// Workspaces is a replacement surface. Invalidate a pending workflow-pin read as soon as it
|
|
9644
|
+
// opens, rather than allowing a late answer to survive behind the project UI until the return.
|
|
9645
|
+
clearKbInformed() {
|
|
9646
|
+
refreshKbInformed(null);
|
|
9520
9647
|
},
|
|
9521
9648
|
copyToClipboard,
|
|
9522
9649
|
instructionFor,
|
package/dist/web/index.html
CHANGED
|
@@ -159,6 +159,18 @@
|
|
|
159
159
|
<button class="find-close" id="find-close" data-tip="Close">×</button>
|
|
160
160
|
</div>
|
|
161
161
|
<div class="notes-strip" id="notes-strip" hidden></div>
|
|
162
|
+
<!-- Which of the firm's own knowledge this workflow was built from, and whether it has changed
|
|
163
|
+
since. Deliberately NOT in the header beside the run-state pill: that pill's "Needs refresh"
|
|
164
|
+
state is amber and means Run is blocked, and a second amber chip inches away saying the
|
|
165
|
+
knowledge moved would read as the same kind of problem. Knowledge drift never blocks Run.
|
|
166
|
+
Hidden outright when the workflow was never built against a knowledge base — which is most
|
|
167
|
+
of them, and is a normal state rather than something to render an empty row about. -->
|
|
168
|
+
<div class="kb-informed" id="kb-informed" hidden>
|
|
169
|
+
<span class="kb-informed-label">Informed by</span>
|
|
170
|
+
<span class="kb-informed-pages" id="kb-informed-pages"></span>
|
|
171
|
+
<span class="kb-drift-chip" id="kb-drift-chip" role="status" hidden
|
|
172
|
+
data-tip="Re-approving isn’t required — this workflow still runs as it is. But the Knowledge Base has changed since these pages were read, so double-check any values that came from them.">Knowledge Base updated since this was built</span>
|
|
173
|
+
</div>
|
|
162
174
|
<div class="topology" id="topology"></div>
|
|
163
175
|
<div class="canvas-toolbar">
|
|
164
176
|
<div class="toolbar-group">
|
package/dist/web/workspaces.js
CHANGED
|
@@ -572,6 +572,9 @@
|
|
|
572
572
|
const ws = mode === 'workspaces';
|
|
573
573
|
$app.classList.toggle('mode-workspaces', ws);
|
|
574
574
|
document.body.classList.toggle('mode-workspaces', ws);
|
|
575
|
+
// The provenance strip is workflow-level data. Workspaces replaces that surface (including its
|
|
576
|
+
// landing), so cancel any late workflow-pin paint before the project UI starts loading.
|
|
577
|
+
if (ws && bridge.clearKbInformed) bridge.clearKbInformed();
|
|
575
578
|
$switch.querySelectorAll('button').forEach((b) => {
|
|
576
579
|
const on = b.dataset.mode === mode;
|
|
577
580
|
b.classList.toggle('active', on);
|
|
@@ -8173,6 +8176,26 @@
|
|
|
8173
8176
|
if ($projPopover && !$projPopover.hidden && $projCombo && !$projCombo.contains(e.target)) closeProjCombo(false);
|
|
8174
8177
|
});
|
|
8175
8178
|
|
|
8176
|
-
|
|
8179
|
+
/**
|
|
8180
|
+
* Open one Knowledge Base page, from outside this module — the "Informed by" row in Workflows mode
|
|
8181
|
+
* is the only caller today. The page viewer is driven by module-private `current` + `viewer` state,
|
|
8182
|
+
* so there is no way in without a seam.
|
|
8183
|
+
*
|
|
8184
|
+
* EVERY await here is load-bearing. `openProject` is async and its `setStep('knowledge')` runs
|
|
8185
|
+
* `kbResetViewer()` → `setViewer({mode:'graph'})`; setting the page viewer before that resolves
|
|
8186
|
+
* would be silently overwritten and drop the user on the graph, looking like the link went to the
|
|
8187
|
+
* wrong place. The `current` re-check afterwards is the ordinary stale-navigation guard — the user
|
|
8188
|
+
* can pick a different project while the open is in flight.
|
|
8189
|
+
*/
|
|
8190
|
+
async function openKnowledgePage(projectId, slug) {
|
|
8191
|
+
if (!projectId || !slug) return;
|
|
8192
|
+
await setMode('workspaces');
|
|
8193
|
+
await openProject(projectId, 'knowledge');
|
|
8194
|
+
if (!current || current.id !== projectId) return; // navigated away mid-open
|
|
8195
|
+
setViewer({ mode: 'page', slug, sourceId: null });
|
|
8196
|
+
renderKnowledge();
|
|
8197
|
+
}
|
|
8198
|
+
|
|
8199
|
+
window.flolessWorkspaces = { setMode, refresh: loadProjects, findActive: wsFindActive, find: wsFind, clearFind: wsClearFind, openHistory: wsOpenHistory, openKnowledgePage };
|
|
8177
8200
|
applyMode(); // restore persisted mode immediately (matches panels.js applyView timing)
|
|
8178
8201
|
})();
|