feat(agent): adopt AI SDK v7 — crash safety, context pruning, HITL approvals (#3362)

* docs(adr): propose agent AI SDK v7 adoption plan

* fix(ai): bind analyzeResume through aiService in service test

The test destructured analyzeResume as a named export that does not exist; main was red.

* test(agent): keep pure ai helpers real via spread-actual mock factory

* feat(agent): add run guards, patch version guard, run wall-clock timeout

* feat(agent): validate UI messages at the send boundary

* feat(agent): crash-safe draft-row persistence and server-side cancellation

* feat(agent): reap stale run claims at boot, on send, and on thread open

* feat(agent): fresh-document patch output and tiered context pruning

* feat(ai): shared agent tool contracts and message metadata schema

* feat(agent): add per-thread review-patches setting with update endpoint

* feat(agent): gate resume patches behind hmac-signed tool approval

* feat(agent): merge question answers and approval decisions before run claim

* feat(agent): approval ui with composed auto-send and fixture-driven tests

* feat(agent): usage metadata, tool activity cards, smoother streaming

* feat(agent): tool-call repair, input examples, structured step logging

* chore(i18n): translate new agent workspace strings across all locales

* fix(agent): gate stale-run draft cancellation on winning the claim clear

Snapshot streaming drafts before the conditional clear and skip the flip entirely when another reaper or a replacement run already cleared the claim. Also address review nits in eleven locale catalogs.

* fix(agent): flip reaped drafts only when their snapshotted state is unchanged

* fix(agent): address review findings across run lifecycle, context budget, and approval flow

- bind patches to the revision the model read via signed baseUpdatedAt
- claim the run before consuming a continuation; recorded-but-unexecuted approvals retry as pending continuations
- keep run ownership on stop() until cancellation persists; preserve the claim for the reaper when final persistence fails
- estimate tokens without serializing binary attachments (tokenx) and enforce the budget by dropping oldest whole turns
- mark crash-recovered patch results as snapshot boundaries; strip /data prefixes at execution time
- retry failed continuations without regenerate; mount a single AgentChat; disable response controls on read-only threads; freeze review toggle during runs (client+server)
- accumulate usage across continuations and match the SDK's nested usage shape; label-form token strings; reorderable source label; accessible note field; state-neutral web-search label

* chore(i18n): translate revised agent strings across all locales

* fix(agent): harden baseUpdatedAt validation and address review follow-ups

- bundle tokenx in the server runtime dependencies (e2e boot failure)
- strict ISO schema for baseUpdatedAt plus loud executor rejection of unparseable values
- it-IT source label consistency (Fonte)
- prove penultimate-turn retention in the context pruning test

* chore(deps): exempt tokenx from knip for the externalized server bundle
This commit is contained in:
Amruth Pillai
2026-08-20 08:06:53 +02:00
committed by GitHub
parent dbbab6fd76
commit c8081ac2fe
95 changed files with 14919 additions and 497 deletions
+103 -3
View File
@@ -543,6 +543,14 @@ msgstr "បានដាក់ពាក្យ"
msgid "Applied on"
msgstr "បានដាក់ពាក្យនៅ"
#: src/routes/agent/-components/patch-approval-card.tsx
msgid "Approve"
msgstr "អនុម័ត"
#: src/routes/agent/-components/patch-approval-card.tsx
msgid "Approved — waiting for the agent…"
msgstr "បានអនុម័ត — កំពុងរង់ចាំភ្នាក់ងារ…"
#: src/libs/locale.ts
msgid "Arabic"
msgstr "Arabic"
@@ -1462,6 +1470,14 @@ msgstr "កំពុង​លុប​កូនសោ API របស់​អ្
msgid "Deleting your resume..."
msgstr "កំពុង​លុប​ប្រវត្តិរូប​របស់​អ្នក..."
#: src/routes/agent/-components/patch-approval-card.tsx
msgid "Denied — waiting for the agent…"
msgstr "បានបដិសេធ — កំពុងរង់ចាំភ្នាក់ងារ…"
#: src/routes/agent/-components/patch-approval-card.tsx
msgid "Deny"
msgstr "បដិសេធ"
#: src/libs/resume/ats.ts
msgid "Describe what you did so the entry contributes keywords for matching."
msgstr "ពណ៌នាអំពីអ្វីដែលអ្នកបានធ្វើ ដូច្នេះធាតុចូលរួមចំណែកពាក្យគន្លឹះសម្រាប់ការផ្គូផ្គង។"
@@ -1530,6 +1546,10 @@ msgstr "បរិច្ចាគ"
msgid "Donate to Reactive Resume"
msgstr "បរិច្ចាគ​ឲ្យ Reactive Resume"
#: src/routes/agent/-components/tool-part-card.tsx
msgid "Done"
msgstr "រួចរាល់"
#. Action button to download two-factor backup codes as a text file
#. Primary action in the builder header to open resume download options
#: src/dialogs/auth/enable-two-factor.tsx
@@ -1642,6 +1662,10 @@ msgstr "កែសម្រួលមាតិកាក្នុងរបៀបព
msgid "Edit date"
msgstr "កែសម្រួលកាលបរិច្ឆេទ"
#: src/routes/agent/-components/patch-approval-card.tsx
msgid "Edit declined"
msgstr "ការកែសម្រួលត្រូវបានបដិសេធ"
#. Resume card context menu action to edit resume metadata
#. Resume card dropdown action to edit resume metadata
#: src/routes/builder/$resumeId/-components/header.tsx
@@ -1837,6 +1861,10 @@ msgstr "នាំចេញប្រវត្តិរូបសង្ខេបរ
msgid "Exported pipeline-flow.png"
msgstr "បាននាំចេញ pipeline-flow.png"
#: src/routes/agent/-components/tool-part-card.tsx
msgid "Failed"
msgstr "បរាជ័យ"
#: src/routes/builder/$resumeId/-sidebar/right/sections/resume-analysis.tsx
msgid "Failed to analyze resume."
msgstr "ការវិភាគប្រវត្តិរូបបានបរាជ័យ។"
@@ -1967,6 +1995,10 @@ msgstr "បរាជ័យក្នុងការផ្តាច់អ្នក
msgid "Failed to update provider."
msgstr "មិនអាចធ្វើបច្ចុប្បន្នភាពអ្នកផ្តល់សេវាបានទេ។"
#: src/routes/agent/-components/agent-chat.tsx
msgid "Failed to update thread settings."
msgstr "បរាជ័យក្នុងការធ្វើបច្ចុប្បន្នភាពការកំណត់ខ្សែស្រឡាយ។"
#. Fallback toast when changing account password fails
#: src/dialogs/auth/change-password.tsx
msgid "Failed to update your password. Please try again."
@@ -3153,6 +3185,14 @@ msgstr "OpenRouter"
msgid "opens in new tab"
msgstr "បើក​ក្នុង​ផ្ទាំង​ថ្មី"
#: src/routes/agent/-components/patch-approval-card.tsx
msgid "Optional note for the agent"
msgstr "ចំណាំស្រេចចិត្តសម្រាប់ភ្នាក់ងារ"
#: src/routes/agent/-components/patch-approval-card.tsx
msgid "Optional note for the agent…"
msgstr "ចំណាំស្រេចចិត្តសម្រាប់ភ្នាក់ងារ…"
#: src/routes/builder/$resumeId/-sidebar/right/sections/sharing.tsx
msgid "Optionally, set a password so that only people with the password can view your resume through the link."
msgstr "ជា​ជម្រើស អ្នក​អាច​កំណត់​ពាក្យសម្ងាត់​មួយ ដូច្នេះ​តែ​មនុស្ស​ដែល​មាន​ពាក្យសម្ងាត់​ប៉ុណ្ណោះ អាច​មើល​ប្រវត្តិរូប​របស់​អ្នក​តាម​តំណ​បាន។"
@@ -3499,6 +3539,10 @@ msgstr "អត្ថបទផ្សព្វផ្សាយ"
msgid "Publisher"
msgstr "អ្នកបោះពុម្ពផ្សាយ"
#: src/routes/agent/-components/agent-chat.tsx
msgid "Raw JSON"
msgstr "JSON ដើម"
#: src/features/applications/components/application-ai-copilot.tsx
msgid "Re-score"
msgstr "ដាក់ពិន្ទុម្តងទៀត"
@@ -3546,10 +3590,18 @@ msgstr "ប្រវត្តិរូបសង្ខេបដែលមានប
msgid "Reactive Resume v4 (JSON)"
msgstr "Reactive Resume v4 (JSON)"
#: src/routes/agent/-components/tool-part-card.tsx
msgid "Read an attachment"
msgstr "បានអានឯកសារភ្ជាប់"
#: src/features/resume/stylesheet/editor.tsx
msgid "Read the Applying Custom Styles guide."
msgstr "សូមអានការណែនាំអំពីការអនុវត្តរចនាប័ទ្មផ្ទាល់ខ្លួន។"
#: src/routes/agent/-components/tool-part-card.tsx
msgid "Read the resume"
msgstr "បានអានប្រវត្តិរូបសង្ខេប"
#: src/features/applications/components/application-form-sheet.tsx
msgid "Reading the posting…"
msgstr "កំពុងអានការប្រកាសការងារ…"
@@ -3700,8 +3752,8 @@ msgid "Restore"
msgstr "ស្ដារឡើងវិញ"
#: src/routes/agent/-components/agent-chat.tsx
msgid "Restore the resume to before this patch? This will roll back this patch and any patches applied after it."
msgstr "ស្ដារប្រវត្តិរូបសង្ខេបទៅមុនបំណះនេះ? វានឹងរំកិលបំណះនេះ និងបំណះណាមួយដែលបានអនុវត្តបន្ទាប់ពីវា។"
msgid "Restore the resume to before this patch?"
msgstr "ស្ដារប្រវត្តិរូបសង្ខេបទៅស្ថានភាពមុនបំណះនេះ?"
#: src/routes/builder/$resumeId/-components/version-history.tsx
msgid "Restore this version?"
@@ -3726,6 +3778,10 @@ msgstr "ការវិភាគប្រវត្តិរូបបានបញ
msgid "Resume content"
msgstr "ខ្លឹមសារនៃប្រវត្តិរូបសង្ខេប"
#: src/routes/agent/-components/patch-approval-card.tsx
msgid "Resume edit"
msgstr "ការកែសម្រួលប្រវត្តិរូបសង្ខេប"
#: src/features/applications/components/application-detail-sheet.tsx
msgid "Resume file"
msgstr "ឯកសារប្រវត្តិរូបសង្ខេប"
@@ -3754,10 +3810,18 @@ msgstr "ប្រវត្តិរូប"
msgid "Retry"
msgstr "សាកល្បងម្តងទៀត"
#: src/routes/agent/-components/agent-chat.tsx
msgid "Review edits"
msgstr "ពិនិត្យការកែសម្រួល"
#: src/routes/agent/-components/agent-chat.tsx
msgid "Review the resume against a job description and ask me questions before changing uncertain sections."
msgstr "សូមពិនិត្យមើលប្រវត្តិរូបសង្ខេបជាមួយនឹងការពិពណ៌នាការងារ ហើយសួរខ្ញុំនូវសំណួរមុនពេលផ្លាស់ប្តូរផ្នែកដែលមិនច្បាស់លាស់។"
#: src/routes/agent/-components/patch-approval-card.tsx
msgid "Review this edit"
msgstr "ពិនិត្យការកែសម្រួលនេះ"
#: src/routes/agent/-components/agent-chat.tsx
msgid "Rework the summary so it targets a senior engineering manager role without sounding generic."
msgstr "សូមធ្វើការសង្ខេបឡើងវិញ ដើម្បីឱ្យវាផ្តោតលើតួនាទីជាអ្នកគ្រប់គ្រងវិស្វកម្មជាន់ខ្ពស់ ដោយមិនស្តាប់ទៅដូចជាទូទៅ។"
@@ -3798,6 +3862,10 @@ msgstr "មុំ​បង្វែរ"
msgid "Run your first analysis to get a scorecard, strengths, and prioritized suggestions."
msgstr "ដំណើរការវិភាគលើកដំបូងរបស់អ្នកដើម្បីទទួលបានតារាងពិន្ទុ ចំណុចខ្លាំង និងសំណើដែលបានកំណត់អាទិភាព។"
#: src/routes/agent/-components/tool-part-card.tsx
msgid "Running…"
msgstr "កំពុងដំណើរការ…"
#: src/libs/locale.ts
msgid "Russian"
msgstr "Russian"
@@ -4253,6 +4321,15 @@ msgstr "ប្រភព"
msgid "Source Code"
msgstr "កូដ​ប្រភព"
#. placeholder {0}: operation.from
#: src/routes/agent/-components/patch-approval-card.tsx
msgid "Source: {0}"
msgstr "ប្រភព៖ {0}"
#: src/routes/agent/-components/agent-chat.tsx
msgid "Sources"
msgstr "ប្រភព"
#: src/routes/builder/$resumeId/-sidebar/right/sections/page.tsx
msgid "Spacing (Horizontal)"
msgstr "គម្លាត (ផ្ដេក)"
@@ -4604,6 +4681,10 @@ msgstr "មិនអាចបើកជំនួយការនេះបានទ
msgid "This date will not be read correctly."
msgstr "កាលបរិច្ឆេទនេះនឹងមិនត្រូវបានអានត្រឹមត្រូវទេ។"
#: src/routes/agent/-components/patch-approval-card.tsx
msgid "This edit request can no longer be answered."
msgstr "សំណើកែសម្រួលនេះមិនអាចឆ្លើយតបបានទៀតទេ។"
#: src/libs/resume/ats.ts
msgid "This email address will not be recognized."
msgstr "អាសយដ្ឋានអ៊ីមែលនេះនឹងមិនត្រូវបានទទួលស្គាល់ទេ។"
@@ -4712,6 +4793,10 @@ msgstr "វានឹងជួយអ្នកកំណត់អត្តសញ្
msgid "This will remove all items from this section."
msgstr "វានឹងលុបធាតុទាំងអស់ចេញពីផ្នែកនេះ។"
#: src/routes/agent/-components/agent-chat.tsx
msgid "This will roll back this patch and any patches applied after it."
msgstr "វានឹងត្រឡប់បំណះនេះ និងបំណះទាំងអស់ដែលបានអនុវត្តបន្ទាប់ពីវាមកវិញ។"
#: src/routes/agent/-components/agent-chat.tsx
#: src/routes/agent/-components/thread-sidebar.tsx
msgid "Thread actions"
@@ -4794,6 +4879,18 @@ msgstr "បិទបើករបារចំហៀងខាងស្តាំ"
msgid "Toggle threads"
msgstr "បិទ/បើកខ្សែស្រឡាយ"
#: src/routes/agent/-components/agent-chat.tsx
msgid "Tokens: {threadTokenTotal}"
msgstr "ថូខឹន៖ {threadTokenTotal}"
#: src/routes/agent/-components/agent-chat.tsx
msgid "Tokens: {total}"
msgstr "ថូខឹន៖ {total}"
#: src/routes/agent/-components/agent-chat.tsx
msgid "Tokens: {total} ({cached} cached)"
msgstr "ថូខឹន៖ {total} ({cached} ក្នុងឃ្លាំងសម្ងាត់)"
#: src/features/applications/components/application-form-sheet.tsx
msgid "Track a job you're applying to and link the resume you sent."
msgstr "តាមដានការងារដែលអ្នកកំពុងដាក់ពាក្យ ហើយភ្ជាប់ប្រវត្តិរូបដែលបានផ្ញើ។"
@@ -5213,6 +5310,10 @@ msgstr "យើងមិនអាចរកឃើញទម្រង់ដោយស
msgid "We couldn't find that page"
msgstr "យើងរកមិនឃើញទំព័រនោះទេ"
#: src/routes/agent/-components/tool-part-card.tsx
msgid "Web search"
msgstr "ការស្វែងរកតាមអ៊ីនធឺណិត"
#: src/dialogs/resume/sections/award.tsx
#: src/dialogs/resume/sections/certification.tsx
#: src/dialogs/resume/sections/education.tsx
@@ -5445,4 +5546,3 @@ msgstr "បង្រួម"
#: src/libs/locale.ts
msgid "Zulu"
msgstr "Zulu"