@floless/app 0.126.1 → 0.126.3

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/web/aware.js CHANGED
@@ -484,18 +484,66 @@
484
484
 
485
485
  // ── gate + notes UI ────────────────────────────────────────────────────────
486
486
 
487
- function paintGate(app) {
488
- // Task-language label (AEC users don't know "lock"/"drift"); the tooltip carries
489
- // the why + the Compile step.
490
- const labels = { ready: 'Ready to run', drift: 'Needs refresh', uncompiled: 'Not set up' };
491
- $runState.className = `run-state ${app.runState}`;
492
- $runState.textContent = labels[app.runState] || '';
493
- const stateTips = {
487
+ // Execution state has precedence over the compile gate. Keep this decision pure so every repaint
488
+ // path (including an async loadApp/paintGate landing mid-run) resolves the same visible status.
489
+ function runStatePresentation(runState, activity = {}) {
490
+ const gate = {
491
+ ready: { label: 'Ready to run', className: 'ready' },
492
+ drift: { label: 'Needs refresh', className: 'drift' },
493
+ uncompiled: { label: 'Not set up', className: 'uncompiled' },
494
+ };
495
+ const finiteRunning = !!(activity.reportRunning || activity.stateRunning);
496
+ if (activity.foregroundStopping || (activity.cancelRequested && finiteRunning)) {
497
+ return { label: 'Cancelling…', className: 'cancelling' };
498
+ }
499
+ if (activity.foregroundStarting) return { label: 'Starting live run…', className: 'running' };
500
+ if (activity.foregroundTrigger) return { label: 'Listening…', className: 'running' };
501
+ if (finiteRunning) {
502
+ return activity.simulating
503
+ ? { label: 'Simulating…', className: 'running' }
504
+ : { label: 'Running…', className: 'running' };
505
+ }
506
+ return gate[runState] || { label: '', className: '' };
507
+ }
508
+
509
+ let reportRunning = false;
510
+ let cancelRequested = false;
511
+ let runningSimulation = false;
512
+ let foregroundTrigger = null;
513
+ let foregroundStarting = false;
514
+ let foregroundStopping = false;
515
+
516
+ function paintRunState(app) {
517
+ const status = runStatePresentation(app.runState, {
518
+ reportRunning,
519
+ stateRunning: state.running,
520
+ simulating: runningSimulation,
521
+ foregroundStarting,
522
+ foregroundTrigger: !!foregroundTrigger,
523
+ foregroundStopping,
524
+ cancelRequested,
525
+ });
526
+ $runState.className = `run-state ${status.className}`;
527
+ $runState.textContent = status.label;
528
+ const gateTips = {
494
529
  ready: 'Ready to run.\nThis workflow was compiled from exactly the current .flo (the approved “lock” matches the source), so ▶ Run workflow is enabled.',
495
530
  drift: 'Needs refresh.\nThe .flo changed since the last Compile, so the approved lock is out of date and Run is blocked. Hit ⎙ Compile to re-approve it.',
496
531
  uncompiled: 'Not set up yet.\nThere is no approved lock for this workflow, so Run is blocked. Hit ⎙ Compile to freeze one — then ▶ Run workflow turns on.',
497
532
  };
498
- $runState.dataset.tip = stateTips[app.runState] || '';
533
+ const activeTips = {
534
+ 'Running…': 'The approved workflow is running against the live host.',
535
+ 'Simulating…': 'The workflow composition is being simulated without contacting the live host.',
536
+ 'Starting live run…': 'The live trigger session is starting.',
537
+ 'Listening…': 'The live trigger session is listening for the next host event.',
538
+ 'Cancelling…': 'The current run is being cancelled.',
539
+ };
540
+ $runState.dataset.tip = activeTips[status.label] || gateTips[app.runState] || '';
541
+ }
542
+
543
+ function paintGate(app) {
544
+ // Task-language label (AEC users don't know "lock"/"drift"); the tooltip carries
545
+ // the why + the Compile step.
546
+ paintRunState(app);
499
547
 
500
548
  // Keep Run disabled (and the header Stop shown) if a gate re-paint lands mid-run (#39) —
501
549
  // never let a re-render re-arm Run while a run is still in flight.
@@ -503,8 +551,8 @@
503
551
  // gate repaint mid-session (e.g. an fs-change → loadApp) must not re-arm Run or
504
552
  // hide the Stop while the watcher is still live. The in-modal Stop tracks the
505
553
  // same state (it's the reachable Stop while the Viewer covers the header one).
506
- $runBtn.disabled = !app.runnable || reportRunning || state.running || !!foregroundTrigger;
507
- if ($stopRunBtn) $stopRunBtn.hidden = !(reportRunning || state.running || foregroundTrigger);
554
+ $runBtn.disabled = !app.runnable || reportRunning || state.running || foregroundStarting || foregroundStopping || !!foregroundTrigger;
555
+ if ($stopRunBtn) $stopRunBtn.hidden = !(reportRunning || state.running || foregroundStopping || foregroundTrigger);
508
556
  if ($reportStop) $reportStop.hidden = !foregroundTrigger;
509
557
  $runBtn.dataset.tip = app.runnable
510
558
  ? 'Run the approved workflow'
@@ -2370,11 +2418,9 @@
2370
2418
  showToast('Inputs set: ' + badge, 'ok');
2371
2419
  }
2372
2420
 
2373
- let reportRunning = false;
2374
2421
  // Set when the user hits Stop. api() throws a bare Error on the cancelled
2375
2422
  // response (the {cancelled:true} flag is lost), so we read this flag in the
2376
2423
  // run catch blocks to show "cancelled" rather than a misleading "run failed".
2377
- let cancelRequested = false;
2378
2424
  // The most recent rendered report per app id: { nodeId, label, html }. Lets a
2379
2425
  // double-click LOAD the last result instantly instead of re-running.
2380
2426
  const lastReportByApp = new Map();
@@ -2387,7 +2433,6 @@
2387
2433
  // (reportRunning). Its session id is server-namespaced with this prefix so its SSE
2388
2434
  // snapshots route here, never to the Routines list.
2389
2435
  const FG_SESSION_PREFIX = '__run__:';
2390
- let foregroundTrigger = null;
2391
2436
 
2392
2437
  // Reflect run-in-flight state in the ALWAYS-VISIBLE header so a run is stoppable even
2393
2438
  // when the HTML Viewer modal is closed (#39). The header ■ Stop run appears for the whole
@@ -2397,14 +2442,15 @@
2397
2442
  // the user, on the modal's × tooltip, that closing leaves the run going (Stop is in the
2398
2443
  // header) — the canvas keeps showing progress (markCanvasRunning), by design.
2399
2444
  function syncRunControls() {
2400
- const running = reportRunning || state.running || !!foregroundTrigger;
2445
+ const running = reportRunning || state.running || foregroundStarting || foregroundStopping || !!foregroundTrigger;
2446
+ const stoppable = reportRunning || state.running || foregroundStopping || !!foregroundTrigger;
2401
2447
  // The in-modal Stop is reachable only for a live foreground session (the header
2402
2448
  // Stop is occluded by the report-modal backdrop). Show it while one is live.
2403
2449
  if ($reportStop) $reportStop.hidden = !foregroundTrigger;
2404
2450
  if ($stopRunBtn) {
2405
- $stopRunBtn.hidden = !running;
2451
+ $stopRunBtn.hidden = !stoppable;
2406
2452
  // Reset to a fresh, clickable Stop each run; stopRun() flips it to "Cancelling…".
2407
- if (running && !cancelRequested) { $stopRunBtn.disabled = false; $stopRunBtn.textContent = '■ Stop run'; }
2453
+ if (stoppable && !cancelRequested && !foregroundStopping) { $stopRunBtn.disabled = false; $stopRunBtn.textContent = '■ Stop run'; }
2408
2454
  }
2409
2455
  if (running) {
2410
2456
  $runBtn.disabled = true;
@@ -2412,6 +2458,8 @@
2412
2458
  const app = currentId && apps.get(currentId);
2413
2459
  $runBtn.disabled = !(app && app.runnable);
2414
2460
  }
2461
+ const app = currentId && apps.get(currentId);
2462
+ if (app) paintRunState(app);
2415
2463
  // Rely on the native `disabled` attribute for AT state (paintGate also flips it); a
2416
2464
  // separate aria-disabled would be redundant and could go stale on a gate re-paint.
2417
2465
  if ($reportClose) {
@@ -2432,17 +2480,22 @@
2432
2480
  // `stopped` SSE snapshot is a harmless no-op rather than a double-handle.
2433
2481
  if (foregroundTrigger) {
2434
2482
  const ft = foregroundTrigger;
2483
+ foregroundStopping = true;
2435
2484
  foregroundTrigger = null;
2436
2485
  if ($stopRunBtn) { $stopRunBtn.disabled = true; $stopRunBtn.textContent = 'Stopping…'; }
2437
2486
  const ovStop = document.querySelector('.overlay-stop');
2438
2487
  if (ovStop) { ovStop.disabled = true; ovStop.textContent = 'Stopping…'; }
2439
- try { await api(`/api/trigger-run/${encodeURIComponent(ft.appId)}/stop`, { method: 'POST' }); } catch { /* best effort — the session may already be gone */ }
2440
- // Clear the canvas "running" pulse just like the regular-run stop below — the
2441
- // early return here previously skipped it, leaving nodes stuck on `running` (#116).
2442
- clearNodeStatus();
2443
- // A deliberate stop needs no toast — the subtitle change is the confirmation.
2444
- paintForegroundStopped('stopped');
2445
2488
  syncRunControls();
2489
+ try { await api(`/api/trigger-run/${encodeURIComponent(ft.appId)}/stop`, { method: 'POST' }); } catch { /* best effort — the session may already be gone */ }
2490
+ finally {
2491
+ // Clear the canvas "running" pulse just like the regular-run stop below — the
2492
+ // early return here previously skipped it, leaving nodes stuck on `running` (#116).
2493
+ clearNodeStatus();
2494
+ // A deliberate stop needs no toast — the subtitle change is the confirmation.
2495
+ paintForegroundStopped('stopped');
2496
+ foregroundStopping = false;
2497
+ syncRunControls();
2498
+ }
2446
2499
  return;
2447
2500
  }
2448
2501
  cancelRequested = true;
@@ -2451,6 +2504,7 @@
2451
2504
  const stopBtn = document.querySelector('.overlay-stop');
2452
2505
  if (stopBtn) { stopBtn.disabled = true; stopBtn.textContent = 'Cancelling…'; }
2453
2506
  if ($stopRunBtn) { $stopRunBtn.disabled = true; $stopRunBtn.textContent = 'Cancelling…'; }
2507
+ syncRunControls();
2454
2508
  try { await api('/api/run/stop', { method: 'POST' }); } catch { /* the run's own catch surfaces it */ }
2455
2509
  }
2456
2510
 
@@ -5747,7 +5801,7 @@
5747
5801
  const app = currentId && apps.get(currentId);
5748
5802
  if (!app) return;
5749
5803
  if (!app.runnable) { showToast($runBtn.dataset.tip, 'warn'); return; }
5750
- if (state.running || reportRunning || foregroundTrigger) return;
5804
+ if (state.running || reportRunning || foregroundStarting || foregroundStopping || foregroundTrigger) return;
5751
5805
 
5752
5806
  // Streaming/watch app → a LIVE FOREGROUND session, not a finite run (which would
5753
5807
  // never complete and time out at 60s). It re-renders the report in the Viewer on
@@ -5761,6 +5815,7 @@
5761
5815
  const rid = reportNodeId();
5762
5816
  if (!simulate && rid) { runReport(rid); return; }
5763
5817
 
5818
+ runningSimulation = simulate;
5764
5819
  state.running = true;
5765
5820
  cancelRequested = false;
5766
5821
  $runBtn.disabled = true;
@@ -5803,6 +5858,7 @@
5803
5858
  }
5804
5859
  } finally {
5805
5860
  state.running = false;
5861
+ runningSimulation = false;
5806
5862
  $runBtn.disabled = false;
5807
5863
  if ($simBtn) $simBtn.disabled = false;
5808
5864
  $runBtn.textContent = '▶ Run workflow';
@@ -6772,194 +6828,32 @@
6772
6828
  saveFavs = function saveFavsNoop() { $favCount.textContent = state.favorites.length; };
6773
6829
 
6774
6830
  // ── reverse channel: record intent for the host AI, copy a paste-ready line ──
6775
- function instructionFor(req) {
6776
- // `t.node` guarded, not assumed: a template saved by an older build (or hand-edited in
6777
- // templates.json) can carry a name and no node, and reading `.agent` off undefined THREW out of
6778
- // renderRequests' .map(), so `$list.innerHTML` was never assigned and loadRequests' `catch {}`
6779
- // ate it — the chip kept counting requests over a list that had silently stopped rendering.
6780
- if (req.type === 'use-template' && req.template) {
6781
- const t = req.template;
6782
- const n = t.node || {};
6783
- return `In floless app "${req.appId}", add a node from my saved template "${t.name}" (agent ${n.agent || n.kind || 'unspecified — read the template from GET /api/templates'}${n.command ? ' / ' + n.command : ''}, config ${JSON.stringify(n.config || {})}). Edit the .flo, then run \`aware app compile\`.`;
6784
- }
6785
- if (req.type === 'tweak') {
6786
- const base = `In floless app "${req.appId}", change only node "${req.nodeId}": ${req.instruction}. Edit just that node in the .flo, then run \`aware app compile\`.`;
6787
- return req.snapshots && req.snapshots.length
6788
- ? `${base}\nReference snapshots (read these for visual context): ${req.snapshots.join(', ')}`
6789
- : base;
6790
- }
6791
- if (req.type === 'ui-customize') {
6792
- const scope = req.panelId ? ` (panel "${req.panelId}")` : '';
6793
- return `Customize my floless.app dashboard${scope}: ${req.instruction}. Edit ~/.floless/ui/extensions.json per the floless-app-ui skill, then check it with \`aware agent invoke ui validate\`.`;
6794
- }
6795
- if (req.type === 'rebake') {
6796
- const where = req.inputName ? ` (input "${req.inputName}")` : '';
6797
- const snaps = req.snapshots && req.snapshots.length
6798
- ? `\nNew drawing${req.snapshots.length > 1 ? 's' : ''} (read for the re-extraction): ${req.snapshots.join(', ')}`
6799
- : '';
6800
- return `In floless app "${req.appId}", re-read & re-bake${where} per the floless-app-rebake skill: ${req.instruction}${snaps}`;
6801
- }
6802
- if (req.type === 'guide') {
6803
- return `Walk me through the floless workflow "${req.appId}" — explain in plain English what it does and how to run it (set its inputs → Compile → ▶ Run). Use your floless-app-${req.appId} skill if one exists; otherwise read the workflow's own description and node notes from GET /api/app/${req.appId} and explain from those. This is a guided explanation — don't change anything.`;
6804
- }
6805
- if (req.type === 'new-workflow') {
6806
- return `Help me build a brand-new floless workflow from scratch, step by step, with your floless-app-new-workflow skill. Ask me what I want it to do, then before writing any node confirm the agents it needs are installed (offer to install a missing one from the catalogue, or to report a not-yet-existing agent as an idea). Author the .flo node by node, verifying each step is correct (plain-English descriptions, validate, compile, a real run), and finish by installing → Compile → ▶ Run so I can see it work and approve.`;
6807
- }
6808
- if (req.type === 'revision-read') {
6809
- const isInitialRead = !req.baseVersion || req.baseVersion <= 0;
6810
- const snaps = req.snapshots && req.snapshots.length
6811
- ? `\n${isInitialRead ? 'Initial' : 'Revised'} drawing${req.snapshots.length > 1 ? 's' : ''} (read these): ${req.snapshots.join(', ')}`
6812
- : '';
6813
- const note = req.instruction ? `\nMy note: ${req.instruction}` : '';
6814
- const messageHint = isInitialRead ? '<plain-English what was read>' : '<plain-English what changed>';
6815
- const post = `Only after the review checkpoint is complete, POST /api/projects/${req.project}/revision-read with { contract, message: "${messageHint}", requestId: "${req.id}" }. The server derives the base version + source provenance from this queued request. For a steel.takeoff/v1 contract it records a "revision-read" version and clears the request. For a steel.model/v2 model it answers 202 and STAGES the read for the user to review instead — the request stays open until they confirm it in the app, and the version appears then. Either way, do NOT DELETE the request yourself. If you can't read the set, POST /api/projects/${req.project}/revision-requests/${req.id}/fail with { error }.`;
6816
- // App-aware: the target contract shape differs per workspace app. A vectorize project holds a
6817
- // drawing.vector/v1 (clean editable 2D linework), NOT a steel takeoff — instructing the AI to
6818
- // read steel members would produce the wrong contract for the vector editor (spec §3.3g).
6819
- // The lineage ROOT, not the live id: these branches encode what CONTRACT SHAPE the app's
6820
- // document has, and a rename moves the id off the built-in they are written against. Sending a
6821
- // renamed vector project down the steel branch asks the AI for a steel.takeoff/v1 — the wrong
6822
- // document entirely. Falls back to appId for an older server that ships no templateId.
6823
- if ((req.appTemplateId || req.appId) === 'vectorize') {
6824
- if (isInitialRead) {
6825
- return `In floless project "${req.project}" (app "${req.appId}"), an initial drawing was attached — trace it into this project as its first version (do NOT create a new project). Vectorize the drawing per the floless-app-vectorize skill into a drawing.vector/v1 contract: emit clean, editable 2D vector geometry (sheets → elements: lines / polylines / curves / text, each on its layer), NOT steel members or a takeoff. A vector PDF is read deterministically (exact geometry, no guessing); a photo, scan or hand sketch is traced by a fenced vision extraction that flags every uncertain stroke (low confidence) for the user's review. ${post}${snaps}${note}`;
6826
- }
6827
- return `In floless project "${req.project}" (app "${req.appId}"), a REVISED drawing was attached — re-read (vectorize) it into the SAME project as a new version (do NOT create a new project). Vectorize the drawing per the floless-app-vectorize skill into a drawing.vector/v1 contract: emit clean, editable 2D vector geometry (sheets → elements: lines / polylines / curves / text, each on its layer), NOT steel members or a takeoff. A vector PDF is read deterministically (exact geometry, no guessing); a photo, scan or hand sketch is traced by a fenced vision extraction that flags every uncertain stroke (low confidence) for the user's review. ${post}${snaps}${note}`;
6828
- }
6829
- // A MIGRATED project holds steel.model/v2, and that changes the document the AI must compose —
6830
- // not merely its wording. The store only accepts v2, so asking for a v1 take-off would have the
6831
- // whole read refused at the gateway AFTER it was done, which is the most expensive place to find
6832
- // out. `contractType` is what the store actually holds today (see requestContractType); it is
6833
- // absent on an older server, and absent falls through to the v1 branches below, unchanged.
6834
- //
6835
- // A revision-read against a v2 project is always a RE-read: v2 is reached by migrating a project
6836
- // that already held a model, so there is no "initial" case to distinguish. What differs from v1 is
6837
- // structural and is spelled out rather than left to be inferred, because every one of these is a
6838
- // place a v1-shaped answer would look plausible: members live at the document ROOT in world
6839
- // millimetres rather than per sheet in display pixels; ids are model-global, so the v1 rule
6840
- // "preserve the id AND its sheet label" does not apply and a bare id is the identity; an elevation
6841
- // the drawing does not give is `{ unknown: true }`, never a substituted default, because a
6842
- // fabricated elevation silently relocates steel; and what each SHEET showed is recorded as
6843
- // evidence on that plan's `memberObservations` instead of by owning the member.
6844
- if (req.contractType === 'steel.model/v2') {
6845
- return `In floless project "${req.project}" (app "${req.appId}"), a REVISED drawing set was attached — re-read it into the SAME project as a new version (do NOT create a new project). This project holds a steel.model/v2 model, so compose a steel.model/v2 document, NOT a steel.takeoff/v1: members live in ONE root \`members[]\` array in WORLD MILLIMETRES (each with \`from\`/\`to\` as { x, y, z }), not per sheet in display pixels. Member ids are MODEL-GLOBAL — preserve the id of every member the revision still shows and mint a new one only for a genuinely new member; there is no sheet label to preserve alongside it. Where the drawing does not give an elevation, write \`{ unknown: true }\` for that z — never a substituted default, because a fabricated elevation moves steel. Record what each SHEET actually showed as evidence on that plan's \`memberObservations\` (with its \`binding.memberIds\`), and use \`plans[].memberRefs\` for members a sheet displays but never observed. COPY THE CURRENT MODEL'S ROOT \`grid\` THROUGH UNCHANGED into the document you post to /revision-read — never omit the key, because omitting it is not how you say "unchanged" and a read that drops it is refused. If the revised set genuinely shows the printed grid in a NEW place, write the new grid there instead: it is staged as a proposal the user accepts in the review, never a silent write. (The pre-read verb below still refuses a grid — that is a different endpoint.) Follow the floless-app-steel-takeoff skill's mandatory two-phase gate exactly as for v1: FIRST GET /api/contract/${req.appId}?project=${req.project} to read the CURRENT model and KEEP its ETag, do the deterministic PyMuPDF steel-filter pass only, send ONLY the pre-read blocks to PUT /api/projects/${req.project}/steel-prepass with { filter } and If-Match: <that ETag> — never the whole contract — then STOP and tell me to open Drawings → Steel Filter, review the facets, and Save. Do NOT read members, build the model, open 3D, or POST /revision-read until I explicitly come back after saving the filter. ${post}${snaps}${note}`;
6846
- }
6847
- if (isInitialRead) {
6848
- return `In floless project "${req.project}" (app "${req.appId}"), an initial drawing set was attached — read it into this project as its first steel model version (do NOT create a new project). Follow the floless-app-steel-takeoff skill's mandatory two-phase gate. FIRST, GET /api/contract/${req.appId}?project=${req.project} and KEEP its ETag response header. A 404 "no contract for this app yet" here is NORMAL and not an error — a project created by dropping a drawing starts empty; it simply means this is the create case, so you will send If-None-Match: * instead of an ETag. (A project seeded from an existing model does return a contract and an ETag.) Then do the deterministic PyMuPDF steel-filter pass only: identify the framing-plan sheets, enumerate the drawing elements by layer/thickness/color into contract.filter.sheets/facets, write it back — if that GET returned NO contract this is the create case, so PUT the whole document to /api/contract/${req.appId}?project=${req.project} with If-None-Match: * ; if it DID return one, send only the pre-read blocks to PUT /api/projects/${req.project}/steel-prepass with { filter } and If-Match: <that ETag>. The prepass verb takes filter, datum and per-sheet { grid, datum_at, datum_ref, control2_at, control2_ref, elevation_in } and REFUSES members, connections and joints by name, so it cannot replace the model you are about to read. Either write is refused with 428 if it carries no precondition, and If-Match must be the exact ETag — If-Match: * is refused, because this verb patches the document you read. On 412 re-GET, re-apply your changes to the new document, and retry rather than repeating the same body. Then STOP and tell me to open Drawings → Steel Filter, review/narrow the steel facets, and Save. Do NOT read members, build the model, open 3D, or POST /revision-read until I explicitly come back after saving the filter. AFTER that saved-filter checkpoint, read members from the saved filter selection and compose the steel.takeoff/v1 contract. ${post}${snaps}${note}`;
6849
- }
6850
- return `In floless project "${req.project}" (app "${req.appId}"), a REVISED drawing set was attached — re-read it into the SAME project as a new version (do NOT create a new project). Follow the floless-app-steel-takeoff skill's mandatory two-phase gate. FIRST, GET /api/contract/${req.appId}?project=${req.project} to read the CURRENT contract, then do the deterministic PyMuPDF steel-filter pass only for the revised drawing set: identify the framing-plan sheets, enumerate drawing elements by layer/thickness/color into contract.filter.sheets/facets, preserve any compatible existing filter selections, send ONLY the pre-read blocks to PUT /api/projects/${req.project}/steel-prepass with { filter } and If-Match: <the ETag from the GET you just did> — never the whole contract, because this project already holds a model and a full PUT would replace its members without review. The verb takes filter, datum and per-sheet { grid, datum_at, datum_ref, control2_at, control2_ref, elevation_in } and refuses everything else by name. A write with no precondition is refused with 428, and If-Match must be the exact ETag — If-Match: * is refused, because this verb patches the document you read. On 412 re-GET, re-apply, and retry rather than repeating the same body. Then STOP and tell me to open Drawings → Steel Filter, review/narrow the steel facets, and Save. Do NOT read members, build the model, open 3D, or POST /revision-read until I explicitly come back after saving the filter. AFTER that saved-filter checkpoint, read members from the saved filter selection, compose the updated steel.takeoff/v1 contract, and PRESERVE each still-present member's id AND its sheet label (mint a NEW id only for a genuinely new member; drop the id of a member the revision deleted) so the version comparison matches members — do NOT renumber the whole model. ${post}${snaps}${note}`;
6851
- }
6852
- // The steel-model editor's "Ask AI" box, and the SAME channel its "insert a detail" flow uses.
6853
- // Deliberately does NOT name a contract shape: this channel serves both steel.takeoff/v1 and
6854
- // steel.model/v2 projects, and the stored document's own `type` is the authoritative answer the
6855
- // AI reads in the GET below. Naming a shape here would send a v2 project's edit at a v1 take-off
6856
- // — the same failure `contractType` exists to prevent on revision-read, solved one rung cheaper
6857
- // because this verb re-writes the document it just read rather than composing a new one.
6858
- if (req.type === 'tweak-contract') {
6859
- const where = req.project ? `?project=${req.project}` : '';
6860
- const scope = req.project ? `floless project "${req.project}" (app "${req.appId}")` : `floless app "${req.appId}"`;
6861
- // The insert flow carries a machine-readable intent + target so the AI creates a new detail
6862
- // rather than editing a placed one (or vice versa) — absent on an ordinary Ask AI request.
6863
- const detail = req.intent
6864
- ? `\nThis is an insert-a-detail request: intent "${req.intent}"${req.target && req.target.sheet ? ` on sheet "${req.target.sheet}"` : ''}${req.target && req.target.ids && req.target.ids.length ? `, target id(s) ${req.target.ids.join(', ')}` : ''}.`
6865
- : '';
6866
- const snaps = req.snapshots && req.snapshots.length
6867
- ? `\nScreenshot${req.snapshots.length > 1 ? 's' : ''} (read these — they show which member or region "this" means): ${req.snapshots.join(', ')}`
6868
- : '';
6869
- return `In ${scope}, edit the steel contract per the floless-app-tweak-contract skill: ${req.instruction || 'apply the requested change'}. ` +
6870
- `GET /api/contract/${req.appId}${where} first and KEEP its ETag — the document's own \`type\` tells you which shape you are editing, and you write back that SAME shape. ` +
6871
- `Apply the change, preserving every field you are not changing, then PUT the full document to /api/contract/${req.appId}${where} with If-Match: <that ETag> ` +
6872
- `(If-None-Match: * only when the GET returned no ETag at all). A blind write is refused with 428; on 412 re-GET, re-apply your edit to the NEW document, and retry rather than repeating the same body. ` +
6873
- `Writing a tweak is not approval — leave the approval gate to the user.${detail}${snaps}`;
6874
- }
6875
- // The Knowledge step's Organize verb. The lifecycle is SERVER-owned: start claims the organize
6876
- // lock and mints the generation dir; finish publishes it and clears this request; fail releases
6877
- // the lock. Naming the exact project-scoped routes matters — /api/requests/<id> is NOT the
6878
- // completion path here, and a stray DELETE would strand the lock until its stale timeout.
6879
- if (req.type === 'knowledge-organize') {
6880
- const kb = `/api/projects/${req.project}/knowledge`;
6881
- return `In floless project "${req.project}", organize the Project Knowledge Base with your floless-app-knowledge skill. ` +
6882
- `Claim the pass with POST ${kb}/requests/${req.id}/start — it takes the organize lock and returns { baseRevision, generationId, wikiDir }. ` +
6883
- `Read the source set from GET ${kb}/status (the rows it marks state:"organizing" ARE this pass's snapshot), read each source's bytes from that project's knowledge/blobs/<blobSha256>, ` +
6884
- `and compile the project wiki INTO the returned wikiDir — never invent a path. ` +
6885
- `Publish with POST ${kb}/requests/${req.id}/finish { generationId, lintSummary }; on any failure release the lock with POST ${kb}/requests/${req.id}/fail { error }. ` +
6886
- `Do NOT DELETE this request and do NOT use /api/requests/${req.id} — finish/fail resolves it server-side. ` +
6887
- `If finish returns { rerun: true } the sources changed mid-pass: POST ${kb}/organize once for a FRESH request, then run start → compile → finish on that new id exactly once.`;
6888
- }
6889
- // The KB "reshape it" box (its UI lands in a later slice; the verb + route already exist).
6890
- if (req.type === 'knowledge-adjust') {
6891
- return `In floless project "${req.project}", reshape the Project Knowledge Base with your floless-app-knowledge skill: ${req.instruction || 'apply the requested change'}. ` +
6892
- `Edit the project's wiki notes accordingly, then re-organize so the published generation reflects the change.`;
6893
- }
6894
- // No branch matched. Fall back to what the USER typed rather than to nothing.
6895
- //
6896
- // Every type in the union has an arm today — 'tweak-contract' was the last one missing and #629
6897
- // gave it one. This is the floor for the NEXT type added to FlolessRequest before its arm lands,
6898
- // because of what that gap cost last time: a blank row in the Requests window AND a
6899
- // markedInstruction() of '', so the ⧉ silently put nothing on the clipboard while still toasting
6900
- // success. The request was never empty — it carried a real instruction — it was just unreadable
6901
- // and uncopyable, which reads as noise worth deleting.
6902
- //
6903
- // A composed arm is strictly better (it tells the terminal AI the protocol, not just the wish),
6904
- // so this never competes with one: every arm above returns first. A type that legitimately
6905
- // carries no instruction still lands on '' here, and the row says so in words.
6906
- return req.instruction ? String(req.instruction).trim() : '';
6907
- }
6908
-
6909
- // Which product skill applies each request type (named in the copied marker so the
6910
- // terminal AI picks up the right one).
6911
- const REQUEST_SKILL = {
6912
- 'use-template': 'floless-app-workflows',
6913
- tweak: 'floless-app-workflows',
6914
- 'ui-customize': 'floless-app-ui',
6915
- 'tweak-contract': 'floless-app-tweak-contract',
6916
- rebake: 'floless-app-rebake',
6917
- 'revision-read': 'floless-app-steel-takeoff',
6918
- // The guided-tour ask is picked up by onboarding; the instruction body names the
6919
- // per-app floless-app-<appId> skill for depth when one exists.
6920
- guide: 'floless-app-onboarding',
6921
- // Build-a-workflow-from-scratch: its own guide skill (interview → author → verify).
6922
- 'new-workflow': 'floless-app-new-workflow',
6923
- // Project Knowledge Base: one self-contained skill drives both the organize lifecycle and adjusts.
6924
- 'knowledge-organize': 'floless-app-knowledge',
6925
- 'knowledge-adjust': 'floless-app-knowledge',
6926
- };
6927
-
6928
- // The COPIED form of a request: instructionFor() prefixed with a self-identifying
6929
- // marker so a PASTED request is unmistakable to the terminal AI — it's a queued FloLess
6930
- // Dashboard request to APPLY (via the named skill + the authoritative /api/requests),
6931
- // not a literal instruction to run verbatim (#73). The modal preview keeps the plain
6932
- // instructionFor() text; only the clipboard carries the marker.
6933
- function markedInstruction(req) {
6934
- const body = instructionFor(req);
6935
- if (!body) return '';
6936
- // revision-read's skill is app-specific: steel takeoff by default, floless-app-vectorize for a
6937
- // vector project — keep the clipboard marker in step with the app-aware instruction body above.
6938
- let skill = REQUEST_SKILL[req.type] || 'floless-app-workflows';
6939
- if (req.type === 'revision-read' && (req.appTemplateId || req.appId) === 'vectorize') skill = 'floless-app-vectorize';
6940
- const base = (typeof location !== 'undefined' && location.origin) ? location.origin : 'http://127.0.0.1:4317';
6941
- // A revision-read is cleared by its own /revision-read POST — a separate DELETE would 404. A
6942
- // knowledge-organize is likewise lifecycle-owned: its finish/fail POST clears it, and a stray
6943
- // DELETE would strand the organize lock until the stale timeout. Every other type is
6944
- // applied-then-DELETEd by the terminal AI.
6945
- const clears = req.type === 'revision-read'
6946
- ? ((req.appTemplateId || req.appId) === 'steel-model'
6947
- ? `apply it in two phases: first write the Steel Filter checkpoint through the steel-prepass verb and stop for user Save; only after that checkpoint use the route in the line below (that POST clears this request, or stages it for the user's review — either way do NOT DELETE it separately).`
6948
- : `apply it via the route in the line below (that POST clears this request — do NOT DELETE it separately).`)
6949
- : req.type === 'knowledge-organize'
6950
- ? `drive it through the start → finish/fail lifecycle routes in the line below (finish or fail clears this request — do NOT DELETE it separately, that would strand the organize lock).`
6951
- : `apply that request, then DELETE ${base}/api/requests/${req.id}.`;
6952
- const marker =
6953
- `[floless-request type=${req.type} id=${req.id}] — queued from the FloLess Dashboard. ` +
6954
- `Apply it with your ${skill} skill: fetch the authoritative spec from GET ${base}/api/requests, ` +
6955
- `${clears} Don't run the line below verbatim.`;
6956
- return `${marker}\n${body}`;
6957
- }
6831
+ //
6832
+ // The prompt is composed SERVER-side now — see server/request-instruction.ts — and every request
6833
+ // view arrives already carrying { prompt, marker }. What used to be ~180 lines of instructionFor()
6834
+ // / REQUEST_SKILL / markedInstruction() here are two ACCESSORS: the browser composes no request
6835
+ // text at all any more. That is the point, not a tidy-up — it is what lets #571s headless run
6836
+ // endpoint take only a request id instead of a caller-supplied prompt, on a server whose CORS hook
6837
+ // deliberately admits callers that send no Origin.
6838
+ //
6839
+ // Two fields joined here rather than one pre-joined server-side because use-template embeds an
6840
+ // unbounded JSON.stringify(node.config) (this repo has a known ~223 KB baked-blob node) and
6841
+ // /api/requests is POLLED — this keeps one copy of that on the wire per poll instead of two.
6842
+ // BOTH fields checked, not just `marker`. The server's invariant is that `marker` is '' exactly
6843
+ // when the body is — but gating on `marker` alone while interpolating `prompt` means a response
6844
+ // carrying one and not the other (an un-enriched route, a partial payload) composes
6845
+ // "[floless-request …]\nundefined": non-empty, so copyToClipboard succeeds and the green
6846
+ // "Copied — paste it to your terminal AI" fires, while the row beside it renders "this request has
6847
+ // no instruction". That is #629's exact signature re-armed one layer up, so the browser does not
6848
+ // lean on a server invariant it cannot see.
6849
+ const instructionFor = (req) => (req && req.prompt) || '';
6850
+ const markedInstruction = (req) => (req && req.marker && req.prompt) ? `${req.marker}\n${req.prompt}` : '';
6958
6851
 
6959
6852
  async function copyToClipboard(text) {
6960
6853
  // Nothing in this app ever legitimately copies an empty string — every caller passes a command
6961
6854
  // or an instruction body. An empty one means the caller has a hole (a request type with no
6962
- // instructionFor() arm returns '' from markedInstruction), and writing it would still resolve,
6855
+ // arm in server/request-instruction.ts composes an empty body, so the server sends no `marker`
6856
+ // and markedInstruction returns ''), and writing it would still resolve,
6963
6857
  // so the user gets a green "Copied" over an empty clipboard. Report the failure instead.
6964
6858
  if (!text) return false;
6965
6859
  try { await navigator.clipboard.writeText(text); return true; } catch { return false; }
@@ -7179,9 +7073,10 @@
7179
7073
  //
7180
7074
  // `r.instruction` — what the USER actually typed — is searched alongside the composed
7181
7075
  // instruction, not instead of it. The two usually overlap, but the composed body is only as
7182
- // complete as instructionFor()'s arms, and a request you can see but cannot find by the words
7183
- // you wrote in it is the worst kind of search. Same forward-looking floor as the fallback at the
7184
- // end of instructionFor(): keep this field even though every type has an arm today.
7076
+ // complete as the server builder's arms (server/request-instruction.ts), and a request you can
7077
+ // see but cannot find by the words you wrote in it is the worst kind of search. Same
7078
+ // forward-looking floor as the fallback at the end of ITS instructionFor(): keep this field even
7079
+ // though every type has an arm today.
7185
7080
  //
7186
7081
  // Both the NAME and the raw ids are searchable: you may know a project as "Cedar Mill Warehouse"
7187
7082
  // or as the `take-5-6677ee` in its URL, and either should find it.
@@ -7266,8 +7161,9 @@
7266
7161
  }
7267
7162
 
7268
7163
  // The Requests window: every queued change in a list, each copyable + clearable,
7269
- // plus copy-all / clear-all. instructionFor() output (which embeds file-derived
7270
- // appId/nodeId/instruction) is rendered via textContent-equivalent escaping.
7164
+ // plus copy-all / clear-all. The server-composed prompt (which embeds file-derived
7165
+ // appId/nodeId/instruction) is rendered via textContent-equivalent escaping — which matters MORE
7166
+ // now that the string arrives over the wire rather than being built from local state.
7271
7167
  function renderRequests() {
7272
7168
  const $list = document.getElementById('requests-list');
7273
7169
  const $clear = document.getElementById('requests-clear');
@@ -8318,8 +8214,13 @@
8318
8214
  // Stop, and reflect the live state. We never compose HTML — the Viewer relays
8319
8215
  // exactly what the node returns (applyTriggerReport paints each fresh report).
8320
8216
  async function startForegroundTrigger(app) {
8321
- if (foregroundTrigger) return;
8217
+ if (foregroundTrigger || foregroundStarting || foregroundStopping) return;
8322
8218
  const id = currentId;
8219
+ // A completed finite-run cancellation leaves this flag set so its late SSE events stay ignored.
8220
+ // A new foreground lifecycle must start clean, or Stop inherits the old disabled/cancelling state.
8221
+ cancelRequested = false;
8222
+ foregroundStarting = true;
8223
+ syncRunControls();
8323
8224
  $reportTitle.textContent = `HTML Viewer · ${app.displayName}`;
8324
8225
  $reportModal.dataset.nodeId = reportNodeId() || '';
8325
8226
  const cached = lastReportByApp.get(id);
@@ -8334,7 +8235,6 @@
8334
8235
  const res = await api('/api/trigger-run', { method: 'POST', body: JSON.stringify({ id, inputs: currentInputs() }) });
8335
8236
  foregroundTrigger = { appId: id, sessionId: res.sessionId, firedCount: 0 };
8336
8237
  markFirstRunDone(id); // a real live session started → a streaming workflow's "first run" is no longer new
8337
- syncRunControls(); // header ■ Stop run becomes reachable; Run disabled while live
8338
8238
  paintForegroundListening();
8339
8239
  appendNarration(`Live session started for <strong>${escapeHtml(id)}</strong> — the report updates on every event. Click <strong>■ Stop run</strong> (top right) to end it.`);
8340
8240
  } catch (e) {
@@ -8358,7 +8258,9 @@
8358
8258
  $reportSub.textContent = 'Live session failed to start.';
8359
8259
  showToast('Live run failed: ' + msg, 'warn');
8360
8260
  }
8361
- syncRunControls();
8261
+ } finally {
8262
+ foregroundStarting = false;
8263
+ syncRunControls(); // starting → listening, or back to the compile gate after a failed start
8362
8264
  }
8363
8265
  }
8364
8266
 
@@ -106,7 +106,7 @@
106
106
  <span class="guide-beacon-ico" aria-hidden="true">✦</span>
107
107
  <span class="guide-beacon-label">Start here</span>
108
108
  </button>
109
- <span class="run-state" id="run-state" role="status" aria-live="polite"></span>
109
+ <span class="run-state" id="run-state" role="status" aria-live="polite" aria-atomic="true"></span>
110
110
  <!-- Restore + Customize: shown for a MAINTAINED (publisher:floless, non-forked) app. Restore
111
111
  appears only when its logic drifted (re-installs the official version); Customize (fork) is
112
112
  always available for a maintained app. When shown on drift they replace Compile, so a
@@ -163,7 +163,9 @@
163
163
  grouped form outright.
164
164
  The three per-container rules keep their SIZING and have dropped the now-inert accent-color, so
165
165
  nothing reads as if that were the remedy. */
166
- input[type=range]{appearance:none;-webkit-appearance:none;width:100%;height:14px;padding:0;border:0;
166
+ /* The 24px border box is the pointer target. Chromium's 14px input formerly kept its 2px UA margin
167
+ on each side, so -3px margins retain that measured 18px outer flex footprint (24 - 3 - 3). */
168
+ input[type=range]{appearance:none;-webkit-appearance:none;width:100%;height:24px;margin-block:-3px;padding:0;border:0;
167
169
  background:transparent;cursor:pointer}
168
170
  input[type=range]::-webkit-slider-runnable-track{height:4px;border-radius:2px;background:var(--line)}
169
171
  input[type=range]::-moz-range-track{height:4px;border-radius:2px;background:var(--line)}
@@ -187,7 +189,9 @@
187
189
  control collapsed to a 120x4 sliver with no handle — measured in Chromium at forced-colors:active,
188
190
  and WORSE than the 16px native widget these users had before this block existed. */
189
191
  input[type=range]{appearance:revert;-webkit-appearance:revert;width:revert;height:revert;
190
- padding:revert;border:revert;background:revert}
192
+ margin-block:revert;padding:revert;border:revert;background:revert}
193
+ /* The OS owns the paint in forced colours; re-assert only target geometry after that hand-back. */
194
+ input[type=range]{height:24px;margin-block:-3px}
191
195
  input[type=range]::-webkit-slider-runnable-track{height:revert;border-radius:revert;background:revert}
192
196
  input[type=range]::-moz-range-track{height:revert;border-radius:revert;background:revert}
193
197
  input[type=range]::-moz-range-progress{height:revert;border-radius:revert;background:revert}
@@ -79,7 +79,9 @@
79
79
  Same declarations as steel-editor.html's block (indentation aside). Nothing enforces that they stay
80
80
  in step; verify-native-controls holds each surface to the contract independently, which is what
81
81
  actually matters if they ever drift. */
82
- input[type=range]{appearance:none;-webkit-appearance:none;width:100%;height:14px;padding:0;border:0;
82
+ /* The 24px border box is the pointer target. Chromium's 14px input formerly kept its 2px UA margin
83
+ on each side, so -3px margins retain that measured 18px outer flex footprint (24 - 3 - 3). */
84
+ input[type=range]{appearance:none;-webkit-appearance:none;width:100%;height:24px;margin-block:-3px;padding:0;border:0;
83
85
  background:transparent;cursor:pointer}
84
86
  input[type=range]::-webkit-slider-runnable-track{height:4px;border-radius:2px;background:var(--line)}
85
87
  input[type=range]::-moz-range-track{height:4px;border-radius:2px;background:var(--line)}
@@ -103,7 +105,9 @@
103
105
  sliver with no handle — measured at forced-colors:active, and worse than the 16px native widget
104
106
  these users had before this block existed. */
105
107
  input[type=range]{appearance:revert;-webkit-appearance:revert;width:revert;height:revert;
106
- padding:revert;border:revert;background:revert}
108
+ margin-block:revert;padding:revert;border:revert;background:revert}
109
+ /* The OS owns the paint in forced colours; re-assert only target geometry after that hand-back. */
110
+ input[type=range]{height:24px;margin-block:-3px}
107
111
  input[type=range]::-webkit-slider-runnable-track{height:revert;border-radius:revert;background:revert}
108
112
  input[type=range]::-moz-range-track{height:revert;border-radius:revert;background:revert}
109
113
  input[type=range]::-moz-range-progress{height:revert;border-radius:revert;background:revert}
@@ -4472,7 +4472,7 @@
4472
4472
  label: 'Working copy · DRAFT', group: 'Drafts',
4473
4473
  });
4474
4474
  for (const saved of data.checkpoints || []) out.push({ selector: { kind: 'checkpoint', checkpointId: saved.checkpointId, expectedHash: saved.hash }, label: `Checkpoint ${String(saved.checkpointId).slice(0, 8)} · DRAFT`, group: 'Drafts', sub: saved.baseVersion ? `Pending work from v${saved.baseVersion}` : 'No approved baseline' });
4475
- for (const row of data.approved || []) {
4475
+ for (const row of data.defaultUnavailable?.reason === 'refused' ? [] : (data.approved || [])) {
4476
4476
  if (!data.default || Number(row.version) !== Number(data.default.version)) out.push({ selector: { kind: 'approved', version: row.version }, label: `Older approved · v${row.version}`, group: 'Approved history' });
4477
4477
  }
4478
4478
  return out;
@@ -4491,7 +4491,8 @@
4491
4491
  function exportSourceHtml() {
4492
4492
  if (exportSourcesState.status === 'loading') return '<div class="export-source-status" role="status">Loading export sources…</div>';
4493
4493
  if (exportSourcesState.status !== 'ready') return '<div class="export-source-status unavailable" role="status">Export sources unavailable — retry by reopening Exports.</div>';
4494
- const options = exportSourceOptions(exportSourcesState.data);
4494
+ const data = exportSourcesState.data || {};
4495
+ const options = exportSourceOptions(data);
4495
4496
  const selected = currentExportSourceOption();
4496
4497
  const selectedKey = selected ? JSON.stringify(selected.selector) : '';
4497
4498
  const grouped = ['Recommended', 'Drafts', 'Approved history'].map((group) => {
@@ -4501,7 +4502,10 @@
4501
4502
  + rows.map((option) => { const key = JSON.stringify(option.selector); return `<button type="button" class="export-source-option${key === selectedKey ? ' selected' : ''}" role="option" aria-selected="${String(key === selectedKey)}" data-export-source="${escapeAttr(key)}"><span>${escapeHtml(option.label)}</span>${option.sub ? `<small>${escapeHtml(option.sub)}</small>` : ''}</button>`; }).join('') + '</div>';
4502
4503
  }).join('');
4503
4504
  let warning = '';
4504
- if (selected && selected.selector.kind === 'latest-approved') {
4505
+ if (data.defaultUnavailable?.reason === 'refused') {
4506
+ const unavailableVersion = data.defaultUnavailable.version ? ` v${data.defaultUnavailable.version}` : '';
4507
+ warning = `<div class="export-source-banner refused" role="alert"><b>Approved${unavailableVersion} is unavailable.</b> ${escapeHtml(data.defaultUnavailable.message)} Review the approval before exporting. <button type="button" data-review-changes>Review approval</button></div>`;
4508
+ } else if (selected && selected.selector.kind === 'latest-approved') {
4505
4509
  warning = approvalState.pendingCount ? `<div class="export-source-banner"><b>${approvalState.pendingCount} pending change${approvalState.pendingCount === 1 ? '' : 's'} aren’t included.</b> Exports use approved v${approvalState.headVersion}. <button type="button" data-review-changes>Review changes</button></div>` : '';
4506
4510
  } else if (selected && (selected.selector.kind === 'working' || selected.selector.kind === 'checkpoint')) {
4507
4511
  warning = '<div class="export-source-banner draft"><b>DRAFT · Unapproved changes will be included.</b> This source is frozen when export starts.</div>';
@@ -4532,7 +4536,9 @@
4532
4536
  // Same split as History's empty state (#490): with a model, Approve is genuinely the unlocking
4533
4537
  // action; with none, `POST …/approve` 404s, so pointing at it is a dead end and the real next
4534
4538
  // step is to go read a drawing. `stepLabel('drawings')` because that label is per-app.
4535
- html += hasModel
4539
+ html += exportSourcesState.data?.defaultUnavailable?.reason === 'refused'
4540
+ ? `<div class="ws-exports-gate refused" role="alert">Exports are paused because the approved snapshot failed its integrity check. <button type="button" data-review-changes>Review approval</button></div>`
4541
+ : hasModel
4536
4542
  ? `<div class="ws-exports-gate">Exports go out after sign-off — ` +
4537
4543
  `<button type="button" id="ws-exports-approve">Approve this version</button> to enable them.</div>`
4538
4544
  : `<div class="ws-exports-gate">Nothing to export yet — ` +
@@ -7624,6 +7630,9 @@
7624
7630
  }
7625
7631
  function openProjMenu(id, anchor) {
7626
7632
  menuFor = id;
7633
+ // An explicit popup wins over the passive fullscreen suggestion. The app-shell listener removes
7634
+ // the nudge synchronously without persisting its seen key, before this menu can receive a click.
7635
+ document.dispatchEvent(new Event('floless:passive-overlay-yield'));
7627
7636
  // The thumbnail items sit beside Rename because they are the same KIND of act — editing how the
7628
7637
  // card presents itself — where Duplicate/Export are lineage and Archive (behind the divider) is
7629
7638
  // lifecycle. "Thumbnail", not "snapshot": this app already spends that word twice (the screenshots
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@floless/app",
3
- "version": "0.126.1",
3
+ "version": "0.126.3",
4
4
  "type": "module",
5
5
  "description": "Thin localhost host for floless.app — serves web/ and shells the aware CLI. No engine, no LLM.",
6
6
  "bin": {