Commits
Marek Vsechovsky committed 4f6251984c6
Session 150, Step 11: Save credit tracking costs to AiCost table for all affected entities - AIM-2796 Save credit tracking costs to AiCost table for all affected entities Outcome: Restructured credit tracking UI in `dashboard-workflow.js`: (1) Aligned `#wfS4CreditProvider` dropdown and `#wfS4StartingCredit` input in a single flex row with `align-items:stretch` so right edges align and the Manage button matches dropdown height. (2) Added pre-fill of starting credit from the active provider's remaining balance on dropdown change and after managing providers. (3) Made `_saveS4CreditToOutput` async — now writes patched content to disk via `AimFS.writeFile` so `_buildProcessItems` reads the updated cost during processing. (4) Added debounced server update of the active purchase's remaining balance when the user edits the starting credit input. The server-side `UpsertAllCostsAsync` in `WorkflowController.cs` already saves costs to AiCost for step, model, user, and project — the missing piece was that the patched cost was never written to disk. Session 150, Step 12: Update Outcome: Applied all 6 UI refinements to credit tracking in `dashboard-workflow.js`: (1) Replaced `<select>` dropdown in Add credit provider dialog with exclusive button bar (Dollars/Credit tokens) using `aim-btn-primary`/`aim-btn-ghost` toggle. (2) Moved `#wfS4ManageProviders` button back to the RIGHT of the credit provider dropdown. (3) Widened dropdown from 180px to 270px. (4) Added "AI credit provider:" label before the dropdown. (5) Both labels use `white-space:nowrap` and the column uses `align-items:flex-end` so right edges align. (6) Moved suffix ($/tokens) back outside the input textbox as a separate `<span>` element. Session 150, Step 13: Update Outcome: Applied both changes: (1) Restructured credit tracking UI as a CSS Grid 3×2 layout (`grid-template-columns:auto auto auto`) with labels right-aligned (column 1), dropdown/input right-aligned (column 2), and config button/suffix left-aligned (column 3). Config button now has explicit `border:1px solid var(--border)`, `background:var(--surface)`, and `height:28px` matching the dropdown. Dropdown popup has `background:var(--surface,#fff)` and `border:1px solid var(--border,#ccc)` with fallback hex values. Menu items have `onmouseover`/`onmouseout` for hover highlight with `border-radius:4px`. (2) Added hard error in `validateOutputFile` when `issues` array exists but is empty — new check `parsed.issues.length === 0` added between the array-type check and the per-issue loop. Session 150, Step 14: Validate that free-text input instructions produce at least one output issue - AIM-2799 Validate that free-text input instructions produce at least one output issue Outcome: Added three changes to `dashboard-project.js`: (1) New `_inputHasFreeTextInstructions(inputText)` function that scans text before the first ```json fence, skipping blockquote lines (`>`), empty lines, and horizontal rules — returns true if any non-boilerplate content remains. (2) Wired `inputHasFreeText: _inputHasFreeTextInstructions(inputText)` into the metadata object returned by `_getInputValidationMeta`. (3) Added hard error check in `validateOutputFile` inside the `inputIdsLoaded` block: if `issueMeta.inputHasFreeText && parsed.issues.length === 0`, emits error 'input file contains free-text instructions but the output has no issues'.