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 "立即將履歷匯出為PDF格式,無需等待或延遲。"
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 "響應式恢復 v<0>{__APP_VERSION__}</0>"
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 "旋轉"
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 "Token{threadTokenTotal}"
#: src/routes/agent/-components/agent-chat.tsx
msgid "Tokens: {total}"
msgstr "Token{total}"
#: src/routes/agent/-components/agent-chat.tsx
msgid "Tokens: {total} ({cached} cached)"
msgstr "Token{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 "祖魯語"