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 "अरबी"
@@ -1462,6 +1470,14 @@ msgstr "तपाईंको API key मेटाइँदैछ..."
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 "निर्यात गरिएको पाइपलाइन प्रवाह।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 "ओपनराउटर"
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 "प्रतिक्रियाशील रिजुमे v<0>{__APP
msgid "Reactive Resume v4 (JSON)"
msgstr "प्रतिक्रियाशील बायोडाटा 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 "घुमाउने कोण (Rotation)"
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 "रुसियन"
@@ -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 "जुलु"