WFDASH-WEBAPP/src/lib/server
Dave 97fc698383 fix(giellie): stale-tab approval guard, size guard, SSE heartbeat, shared in-flight set
- decision endpoint requires pendingKey; mismatch with the stored pending is a 409
- refuse to continue chats over 1.5M chars; compact pending.completed on save
- SSE ": ping" heartbeat every 15s, cleared on finish/cancel
- in-flight set lives on globalThis (survives HMR, shared across bundles)
- resolveOrigin ignores non-http(s) env values; log sanitised cause on tool-load 503
- approval card shows the confirm reason; trust caption updated

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-01 00:36:55 +02:00
..
agent-auth.test.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
agent-auth.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
ai-settings-service.ts feat: add AI quote processing pipeline and admin settings UI 2026-08-09 16:17:29 +02:00
ai-system-prompt.ts feat: add AI quote processing pipeline and admin settings UI 2026-08-09 16:17:29 +02:00
attachment-compressor.test.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
attachment-compressor.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
attachment-extractor.ts feat: add AI quote processing pipeline and admin settings UI 2026-08-09 16:17:29 +02:00
audit-context.test.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
audit-context.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
audit-log-service.test.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
audit-log-service.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
boss-dashboard-service.test.ts test(boss-dashboard): honour expand in mock + assert customer name in rep activity 2026-08-28 00:02:02 +02:00
boss-dashboard-service.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
browser-session.test.ts feat(giellie): service layer and authenticated SSE API routes 2026-09-30 23:54:52 +02:00
browser-session.ts feat(giellie): service layer and authenticated SSE API routes 2026-09-30 23:54:52 +02:00
buyer-tasks-service.test.ts feat(quotes): enhance scoring logic to include price matching 2026-08-24 07:09:39 +02:00
buyer-tasks-service.ts feat(quotes): enhance scoring logic to include price matching 2026-08-24 07:09:39 +02:00
collection-confirm-service.test.ts feat(collection-confirm): update stock item filtering logic in listCollectedItems 2026-08-17 08:27:36 +02:00
collection-confirm-service.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
collection-confirm-upload.test.ts feat: add new order, invoice, and dashboard management tools 2026-08-05 23:00:54 +02:00
completed-window.test.ts feat(quotes): enhance scoring logic to include price matching 2026-08-24 07:09:39 +02:00
counter-service.ts feat(counter): add standalone counter order PWA 2026-08-13 09:27:20 +02:00
customers-coordinates.test.ts feat(visits): batch pin tool — tag every customer on a shaft at once 2026-09-07 08:30:23 +02:00
customers-service.test.ts feat(tv): add TV dashboard + refine workflows 2026-08-13 20:55:22 +02:00
customers-service.ts feat(customers): add status toggle and site/location field 2026-09-16 09:47:09 +02:00
dashboard-service.test.ts feat: add new order, invoice, and dashboard management tools 2026-08-05 23:00:54 +02:00
dashboard-service.ts feat: add new order, invoice, and dashboard management tools 2026-08-05 23:00:54 +02:00
deliveries-service.test.ts feat(deliveries): enhance delivery notes management and UI 2026-08-17 01:27:03 +02:00
deliveries-service.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
delivery-note-order-match.test.ts feat(orders): include selling_price in duplicate-detection line match 2026-08-31 09:03:00 +02:00
delivery-note-order-match.ts feat(orders): include selling_price in duplicate-detection line match 2026-08-31 09:03:00 +02:00
delivery-notes-service.test.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
delivery-notes-service.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
driver-stops.ts fix(orders): bill the customer quantity, not the supplier order_qty 2026-08-30 18:28:33 +02:00
giellie-agent.test.ts fix(giellie): args-aware tool policy, deny quotes.re_run_ai, harden bridge and agent 2026-10-01 00:36:54 +02:00
giellie-agent.ts fix(giellie): args-aware tool policy, deny quotes.re_run_ai, harden bridge and agent 2026-10-01 00:36:54 +02:00
giellie-attachments.test.ts feat(giellie): system prompt and attachment ingestion 2026-09-30 23:42:35 +02:00
giellie-attachments.ts feat(giellie): system prompt and attachment ingestion 2026-09-30 23:42:35 +02:00
giellie-chat-store.test.ts fix(giellie): stale-tab approval guard, size guard, SSE heartbeat, shared in-flight set 2026-10-01 00:36:55 +02:00
giellie-chat-store.ts fix(giellie): stale-tab approval guard, size guard, SSE heartbeat, shared in-flight set 2026-10-01 00:36:55 +02:00
giellie-http.test.ts fix(giellie): stale-tab approval guard, size guard, SSE heartbeat, shared in-flight set 2026-10-01 00:36:55 +02:00
giellie-http.ts fix(giellie): stale-tab approval guard, size guard, SSE heartbeat, shared in-flight set 2026-10-01 00:36:55 +02:00
giellie-mcp-bridge.test.ts fix(giellie): args-aware tool policy, deny quotes.re_run_ai, harden bridge and agent 2026-10-01 00:36:54 +02:00
giellie-mcp-bridge.ts fix(giellie): args-aware tool policy, deny quotes.re_run_ai, harden bridge and agent 2026-10-01 00:36:54 +02:00
giellie-service.test.ts fix(giellie): stale-tab approval guard, size guard, SSE heartbeat, shared in-flight set 2026-10-01 00:36:55 +02:00
giellie-service.ts fix(giellie): stale-tab approval guard, size guard, SSE heartbeat, shared in-flight set 2026-10-01 00:36:55 +02:00
giellie-system-prompt.test.ts fix(giellie): args-aware tool policy, deny quotes.re_run_ai, harden bridge and agent 2026-10-01 00:36:54 +02:00
giellie-system-prompt.ts fix(giellie): args-aware tool policy, deny quotes.re_run_ai, harden bridge and agent 2026-10-01 00:36:54 +02:00
giellie-tool-policy.catalogue.test.ts fix(giellie): args-aware tool policy, deny quotes.re_run_ai, harden bridge and agent 2026-10-01 00:36:54 +02:00
giellie-tool-policy.test.ts fix(giellie): args-aware tool policy, deny quotes.re_run_ai, harden bridge and agent 2026-10-01 00:36:54 +02:00
giellie-tool-policy.ts fix(giellie): args-aware tool policy, deny quotes.re_run_ai, harden bridge and agent 2026-10-01 00:36:54 +02:00
invoice-backfill.test.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
invoice-backfill.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
item-history-service.test.ts feat(item-history): wire description-fuzzy matcher into getItemHistory 2026-07-29 17:43:59 +02:00
item-history-service.ts feat(context): implement getOrderItemContext (5 PB reads, fuzzy fallback) 2026-08-07 02:34:45 +02:00
item-intel-service.ts feat(mcp): implement structured MCP error handling for upstream fetches 2026-08-15 22:32:11 +02:00
management-service.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
mcp-upstream-fetch.test.ts feat(mcp): implement structured MCP error handling for upstream fetches 2026-08-15 22:32:11 +02:00
mcp-upstream-fetch.ts feat(mcp): implement structured MCP error handling for upstream fetches 2026-08-15 22:32:11 +02:00
order-completion.test.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
order-completion.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
order-delivery-note-link-service.test.ts feat(orders): include selling_price in duplicate-detection line match 2026-08-31 09:03:00 +02:00
order-delivery-note-link-service.ts feat(orders): include selling_price in duplicate-detection line match 2026-08-31 09:03:00 +02:00
order-item-context-service.test.ts test(context): getOrderItemContext unit tests (null, quote, stock low/out, invoiced) 2026-08-07 02:42:57 +02:00
order-item-context-service.ts chore(context): lint + build adjustments 2026-08-07 03:04:28 +02:00
order-item-margin-approval-service.test.ts feat(orders): bypass margin gate for non-invoiceable extras 2026-08-30 17:21:28 +02:00
order-item-margin-approval-service.ts feat(orders): bypass margin gate for non-invoiceable extras 2026-08-30 17:21:28 +02:00
order-item-status.test.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
order-item-status.ts feat(order-items): below-22% margin approval workflow 2026-08-04 00:58:33 +02:00
order-items-service.test.ts fix(invoicing): bill only what's collected, support partial pickups + kit splits 2026-09-17 13:53:36 +02:00
order-items-service.ts fix(invoicing): bill only what's collected, support partial pickups + kit splits 2026-09-17 13:53:36 +02:00
order-number-duplicate-link-service.test.ts fix(orders): document PB schema prerequisite + strengthen duplicate-matcher tests 2026-08-30 22:08:24 +02:00
order-number-duplicate-link-service.ts fix(orders): document PB schema prerequisite + strengthen duplicate-matcher tests 2026-08-30 22:08:24 +02:00
order-order-duplicate-link-service.test.ts perf(orders): bulk-fetch candidate items in suggestOrderDuplicate (kill N+1) 2026-08-30 23:57:20 +02:00
order-order-duplicate-link-service.ts feat(orders): include selling_price in duplicate-detection line match 2026-08-31 09:03:00 +02:00
order-quote-link-service.test.ts feat(orders): add quote-match backlog sweep with age-gap reporting 2026-08-30 08:45:23 +02:00
order-quote-link-service.ts feat(orders): add quote-match backlog sweep with age-gap reporting 2026-08-30 08:45:23 +02:00
order-quote-match.test.ts fix(orders): parse PocketBase date format explicitly in the matcher 2026-08-29 13:20:40 +02:00
order-quote-match.ts fix(orders): parse PocketBase date format explicitly in the matcher 2026-08-29 13:20:40 +02:00
orders-service-review.test.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
orders-service.test.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
orders-service.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
po-email-template.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
po-number.test.ts feat: add server-side quote search & PO number format update 2026-08-14 11:15:38 +02:00
po-number.ts feat: add server-side quote search & PO number format update 2026-08-14 11:15:38 +02:00
pocketbase-admin.test.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
pocketbase-admin.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
pos-auth.test.ts feat(pos): add assertPosAuth for POS_API_KEY-gated routes 2026-08-31 01:30:52 +02:00
pos-auth.ts feat(pos): add assertPosAuth for POS_API_KEY-gated routes 2026-08-31 01:30:52 +02:00
pos-letterhead-service.ts fix(pos): print the letterhead's own logo, and match delivery note to the sale slip 2026-09-06 23:03:24 +02:00
pos-service.test.ts feat: implement discount functionality in POS system 2026-09-03 12:19:21 +02:00
pos-service.ts fix(pos): fix uncaught 500 on checkout, allow overselling into negative stock 2026-09-04 13:00:12 +02:00
pos-slip-layout-service.test.ts feat(pos): add pos-slip-layout-service for reading/writing per-letterhead slip layouts 2026-09-04 13:23:09 +02:00
pos-slip-layout-service.ts feat(pos): add pos-slip-layout-service for reading/writing per-letterhead slip layouts 2026-09-04 13:23:09 +02:00
price-list-match.test.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
price-list-match.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
price-list-service.test.ts feat(stock): seed pricing fields on create + sync price_list to stock_items 2026-09-14 13:04:08 +02:00
price-list-service.ts feat(stock): seed pricing fields on create + sync price_list to stock_items 2026-09-14 13:04:08 +02:00
purchase-order-agent-service.test.ts feat(collection-confirm): add stock item edits 2026-08-14 16:39:46 +02:00
purchase-order-agent-service.ts feat(collection-confirm): add stock item edits 2026-08-14 16:39:46 +02:00
purchase-orders-service.test.ts feat(po): resend purchase order from sent / mail_failed / sending statuses 2026-08-04 20:05:52 +02:00
purchase-orders-service.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
quote-email-template.ts feat(quotes): add approval page and email updates 2026-08-11 16:09:40 +02:00
quote-items-insights-service.test.ts feat: add AI quote processing pipeline and admin settings UI 2026-08-09 16:17:29 +02:00
quote-items-insights-service.ts feat: add AI quote processing pipeline and admin settings UI 2026-08-09 16:17:29 +02:00
quote-items-service.test.ts feat(mcp): add walk-in quote creation and enhance customer filtering 2026-08-15 11:50:48 +02:00
quote-items-service.ts feat(quotes): enhance quotes.submit functionality and error handling 2026-08-15 23:57:51 +02:00
quote-pdf-service.test.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
quote-pdf-service.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
quoted-before-service.test.ts feat(quotes): add quote-level "Quoted before?" panel to the process page 2026-08-29 08:52:19 +02:00
quoted-before-service.ts feat(quotes): add quote-level "Quoted before?" panel to the process page 2026-08-29 08:52:19 +02:00
quotes-ai-processor.ts feat: add AI quote processing pipeline and admin settings UI 2026-08-09 16:17:29 +02:00
quotes-from-email-service.test.ts fix(quotes-intake): clamp email_body to PB's 5000-char cap 2026-09-08 10:28:20 +02:00
quotes-from-email-service.ts fix(quotes-intake): clamp email_body to PB's 5000-char cap 2026-09-08 10:28:20 +02:00
quotes-search-service.test.ts fix(quotes-search): order hits by created desc so the most recent match is on top 2026-09-08 10:24:34 +02:00
quotes-search-service.ts fix(quotes-search): order hits by created desc so the most recent match is on top 2026-09-08 10:24:34 +02:00
quotes-service.test.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
quotes-service.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
rep-dashboard-service.test.ts feat(dashboard2): trim Row 1 to Selling-only with last-month delta 2026-09-01 01:55:52 +02:00
rep-dashboard-service.ts perf(dashboard2): consolidate 14 PB count queries into 1 fetch 2026-09-01 02:08:52 +02:00
rep-performance-service.test.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
rep-performance-service.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
rep-time-log-service.test.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
rep-time-log-service.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
repairs-service.test.ts feat(stock): update pricing logic and transform script for fasteners 2026-09-21 12:32:44 +02:00
repairs-service.ts feat(stock): update pricing logic and transform script for fasteners 2026-09-21 12:32:44 +02:00
stock-booking-service.test.ts feat: add split views, stock picking slips, and invoice viewer 2026-08-09 23:16:55 +02:00
stock-booking-service.ts feat(stock): implement auto-markup for selling price and markup on stock item creation and updates 2026-09-16 09:49:52 +02:00
stock-cost-service.ts feat(stock): implement auto-markup for selling price and markup on stock item creation and updates 2026-09-16 09:49:52 +02:00
stock-default-markup-service.test.ts feat(stock): implement auto-markup for selling price and markup on stock item creation and updates 2026-09-16 09:49:52 +02:00
stock-default-markup-service.ts feat(stock): implement auto-markup for selling price and markup on stock item creation and updates 2026-09-16 09:49:52 +02:00
stock-items-export.test.ts feat: implement discount functionality in POS system 2026-09-03 12:19:21 +02:00
stock-items-import.test.ts feat: implement discount functionality in POS system 2026-09-03 12:19:21 +02:00
stock-items-service.test.ts feat(stock): implement auto-markup for selling price and markup on stock item creation and updates 2026-09-16 09:49:52 +02:00
stock-items-service.ts feat(stock): implement auto-markup for selling price and markup on stock item creation and updates 2026-09-16 09:49:52 +02:00
stock-out.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
stock-pricing-service.test.ts test(stock): cover validation + not_found + per-row independence 2026-08-31 16:48:40 +02:00
stock-pricing-service.ts fix(stock): skip ledger row on first-time pricing + include cost delta in notes 2026-08-31 16:46:42 +02:00
stock-purchase-invoice-matching-service.test.ts feat(mcp): expand stock purchase invoice matching service with 5 phases 2026-08-09 20:23:36 +02:00
stock-purchase-invoice-matching-service.ts feat: add split views, stock picking slips, and invoice viewer 2026-08-09 23:16:55 +02:00
stock-purchase-items-service.test.ts chore(tests): fix ~60 pre-existing TS errors across 11 test files 2026-08-27 04:43:40 +02:00
stock-purchase-items-service.ts feat(collection-confirm): add quantity collection handling and deduplication improvements 2026-08-17 02:17:27 +02:00
stock-purchases-migration.test.ts feat(item-history): add getItemHistory service with 5 PB queries 2026-07-29 14:51:58 +02:00
stock-purchases-service.attachments.test.ts feat(stock-purchases): add additional_attachments service helpers 2026-08-06 23:20:26 +02:00
stock-purchases-service.test.ts feat: add split views, stock picking slips, and invoice viewer 2026-08-09 23:16:55 +02:00
stock-purchases-service.ts feat: add split views, stock picking slips, and invoice viewer 2026-08-09 23:16:55 +02:00
stock-quantities-service.test.ts feat(stock): inline qty editing + column sort + pricing-gap operator scripts 2026-09-14 13:04:26 +02:00
stock-quantities-service.ts feat(stock): inline qty editing + column sort + pricing-gap operator scripts 2026-09-14 13:04:26 +02:00
stock-quick-draft-service.test.ts feat(stock): implement auto-markup for selling price and markup on stock item creation and updates 2026-09-16 09:49:52 +02:00
stock-quick-draft-service.ts feat(stock): implement auto-markup for selling price and markup on stock item creation and updates 2026-09-16 09:49:52 +02:00
stock-surplus.test.ts fix(orders): bill the customer quantity, not the supplier order_qty 2026-08-30 18:28:33 +02:00
stock-surplus.ts fix(orders): bill the customer quantity, not the supplier order_qty 2026-08-30 18:28:33 +02:00
tracker-service.test.ts feat(tracker): breadcrumb poller — WFDASH's own vehicle position history 2026-09-06 20:08:20 +02:00
tracker-service.ts feat(tracker): breadcrumb poller — WFDASH's own vehicle position history 2026-09-06 20:08:20 +02:00
travel-history-parser.test.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
travel-history-parser.ts feat(audit): implement audit trail for delivery notes and orders 2026-09-30 01:48:44 +02:00
tv-dashboard-service.ts feat(tv-dashboard): enhance TV dashboard with driver stops and performance metrics 2026-08-19 10:16:49 +02:00
tv-session.ts feat(tv): add TV dashboard + refine workflows 2026-08-13 20:55:22 +02:00
vehicle-trail-service.test.ts feat(tracker): breadcrumb poller — WFDASH's own vehicle position history 2026-09-06 20:08:20 +02:00
vehicle-trail-service.ts feat(tracker): breadcrumb poller — WFDASH's own vehicle position history 2026-09-06 20:08:20 +02:00
visits-service.test.ts feat(rep): add /rep/visits map with heatmap, per-customer clusters 2026-09-20 23:50:03 +02:00
visits-service.ts feat(rep): add /rep/visits map with heatmap, per-customer clusters 2026-09-20 23:50:03 +02:00