toga-ai 1.0.66 → 1.0.67
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.
|
@@ -5,7 +5,7 @@ project: Worker
|
|
|
5
5
|
client: tow-foundation
|
|
6
6
|
type: client-feature
|
|
7
7
|
status: active
|
|
8
|
-
updated: 2026-06-
|
|
8
|
+
updated: 2026-06-12
|
|
9
9
|
owners: ["rgirish"]
|
|
10
10
|
files:
|
|
11
11
|
- worker2/Worker/Client/TowFoundation.php
|
|
@@ -35,15 +35,13 @@ Optional filter parameters: `limit` (int), `year` (string e.g. `"2026"`), `perso
|
|
|
35
35
|
### SharePoint folder structure
|
|
36
36
|
```
|
|
37
37
|
Credit Card Receipts/
|
|
38
|
+
3. QB Excel/ ← generated Excel files for ALL persons uploaded here after each run
|
|
38
39
|
{Person}/
|
|
39
40
|
{Year}/
|
|
40
41
|
{BillingCycleFolder}/ ← receipt files live here (e.g. "Amex ending in 06-03-2026")
|
|
41
42
|
{Person} reports/ ← .xlsx billing statements for cross-verification
|
|
42
|
-
Archive/
|
|
43
|
-
|
|
44
|
-
exception/
|
|
45
|
-
{Person}/ ← failed receipts land here (original name preserved)
|
|
46
|
-
3. QB Excel/ ← generated Excel files uploaded here after each run
|
|
43
|
+
Archive/ ← successfully processed receipts land here (renamed, flat)
|
|
44
|
+
Archive/exception/ ← failed receipts land here (original name preserved, flat)
|
|
47
45
|
```
|
|
48
46
|
|
|
49
47
|
### Processing flow
|
|
@@ -55,18 +53,18 @@ Credit Card Receipts/
|
|
|
55
53
|
and parsed upfront via PhpSpreadsheet (auto-detect header row by scanning for
|
|
56
54
|
description/amount keywords)
|
|
57
55
|
5. **Pass 1 — Extract** — for each receipt:
|
|
58
|
-
- Enforce size limit (4 MB images, 10 MB documents
|
|
56
|
+
- Enforce type + size limit: unsupported mime types (`application/octet-stream`) throw immediately; 4 MB cap for images, 10 MB for documents
|
|
59
57
|
- Download file bytes from SharePoint
|
|
60
58
|
- POST to Talos AI `/api/ai/generate` → structured `{vendor_name, invoice_date, total, payment_memo, category, ...}`
|
|
61
59
|
- Cross-verify amount ± $0.01 against parsed statement; if matched, override `payment_memo` with statement description
|
|
62
60
|
- Build base filename (no suffix yet) and store in `$pendingRenames`
|
|
63
|
-
- On extract failure → move to `Archive/exception
|
|
61
|
+
- On extract failure → move to `Archive/exception/` immediately
|
|
64
62
|
6. **Collision detection** — count base name occurrences across all pending renames
|
|
65
63
|
7. **Pass 2 — Move** — for each pending rename:
|
|
66
64
|
- If base name appears more than once, assign `_a`, `_b`, `_c`... suffix to **all** colliding files (including the first)
|
|
67
|
-
- PATCH SharePoint to rename + move to `Archive
|
|
65
|
+
- PATCH SharePoint to rename + move to `Archive/` (flat — no person subfolder)
|
|
68
66
|
8. **Excel generation** — one `.xlsx` per person (PhpSpreadsheet); columns: Row #, Account Name, QB Vendor, Payment Amount, Date, Payment Method, Payment Memo, QB Description, Class, Category, Payment Account, Ref No.
|
|
69
|
-
9. **SharePoint upload** — each Excel uploaded to `
|
|
67
|
+
9. **SharePoint upload** — each Excel uploaded to root-level `Credit Card Receipts/3. QB Excel/` via Graph API PUT (shared folder for all persons)
|
|
70
68
|
10. **Summary email** — sent with Excel files attached; To: Jheanelle, CC: Magdalena, BCC: devteam@togatech.com
|
|
71
69
|
|
|
72
70
|
### Renamed file format
|
|
@@ -124,7 +122,18 @@ Fatal errors send only to `NOTIFY_EMAIL_DEV` (no CC/BCC).
|
|
|
124
122
|
- **No client DB** — there is no audit trail in MySQL. All state lives in SharePoint folder
|
|
125
123
|
structure and email. If a run is interrupted mid-way, some receipts may be archived
|
|
126
124
|
without a corresponding Excel row.
|
|
125
|
+
- **Unsupported file types** — macOS `.textClipping` files and any file resolving to
|
|
126
|
+
`application/octet-stream` are rejected with a `ReceiptProcessingException` at the
|
|
127
|
+
size-check stage (before download). They land in `Archive/exception/` and appear in the
|
|
128
|
+
summary email so Jheanelle can clean them up manually.
|
|
129
|
+
- **Archive folders are flat** — processed files land directly in `Archive/` and failed
|
|
130
|
+
files in `Archive/exception/` with no extra person subfolder. The Archive is already
|
|
131
|
+
scoped inside `{Person}/{Year}/` so the extra nesting is redundant.
|
|
132
|
+
- **QB Excel goes to the root `3. QB Excel/` folder** — all persons' Excels land in
|
|
133
|
+
`Credit Card Receipts/3. QB Excel/` (not inside each person's subfolder). This folder
|
|
134
|
+
exists at the root of `Credit Card Receipts/` alongside the person folders.
|
|
127
135
|
|
|
128
136
|
## Change history
|
|
129
137
|
|
|
138
|
+
- 2026-06-12 — QB Excel upload moved to root-level `3. QB Excel/`; Archive/exception folders flattened (no person subfolder); unsupported mime types (`application/octet-stream`) now throw ReceiptProcessingException instead of being silently skipped (rgirish)
|
|
130
139
|
- 2026-06-11 — Added CC (Magdalena), BCC (devteam@togatech.com), per-cardholder Archive subfolders, Excel upload to "3. QB Excel" SharePoint folder, two-pass rename with alphabetical duplicate suffix, rename format changed to `YYYY.MM.DD Full Name_Vendor_Amount` (rgirish)
|
package/package.json
CHANGED