@agent-native/core 0.76.10 → 0.76.12
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.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +13 -0
- package/corpus/core/docs/content/locales/ar-SA/actions.md +7 -7
- package/corpus/core/docs/content/locales/ar-SA/template-plan.md +6 -4
- package/corpus/core/docs/content/locales/de-DE/actions.md +9 -9
- package/corpus/core/docs/content/locales/de-DE/template-plan.md +6 -4
- package/corpus/core/docs/content/locales/es-ES/actions.md +9 -9
- package/corpus/core/docs/content/locales/es-ES/template-plan.md +6 -4
- package/corpus/core/docs/content/locales/fr-FR/actions.md +9 -9
- package/corpus/core/docs/content/locales/fr-FR/template-plan.md +6 -4
- package/corpus/core/docs/content/locales/hi-IN/actions.md +9 -9
- package/corpus/core/docs/content/locales/hi-IN/template-plan.md +4 -4
- package/corpus/core/docs/content/locales/ja-JP/actions.md +9 -9
- package/corpus/core/docs/content/locales/ja-JP/template-plan.md +4 -4
- package/corpus/core/docs/content/locales/ko-KR/actions.md +9 -9
- package/corpus/core/docs/content/locales/ko-KR/template-plan.md +4 -4
- package/corpus/core/docs/content/locales/pt-BR/actions.md +9 -9
- package/corpus/core/docs/content/locales/pt-BR/template-plan.md +6 -4
- package/corpus/core/docs/content/locales/zh-CN/actions.md +9 -9
- package/corpus/core/docs/content/locales/zh-CN/template-plan.md +4 -4
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/client/ErrorBoundary.tsx +151 -10
- package/corpus/core/src/client/FeedbackButton.tsx +162 -18
- package/corpus/core/src/client/blocks/library/AnnotatedCodeBlock.tsx +11 -2
- package/corpus/core/src/client/blocks/library/ApiEndpointBlock.tsx +46 -19
- package/corpus/core/src/client/blocks/library/MermaidBlock.tsx +7 -5
- package/corpus/core/src/client/blocks/library/block-copy.ts +367 -0
- package/corpus/core/src/client/blocks/library/diagram.tsx +8 -6
- package/corpus/core/src/client/blocks/library/wireframe.tsx +7 -2
- package/corpus/core/src/client/i18n.tsx +4 -0
- package/corpus/templates/analytics/app/components/layout/CommandPalette.tsx +51 -31
- package/corpus/templates/analytics/app/components/layout/DashboardHeader.tsx +26 -16
- package/corpus/templates/analytics/app/components/layout/Header.tsx +1 -2
- package/corpus/templates/analytics/app/components/layout/HeaderActions.tsx +8 -1
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +2 -5
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +172 -107
- package/corpus/templates/analytics/app/i18n-data.ts +1076 -5
- package/corpus/templates/analytics/app/pages/Settings.tsx +2 -2
- package/corpus/templates/analytics/changelog/2026-06-24-analytics-navigation-command-palette-and-settings-now-honor-.md +6 -0
- package/corpus/templates/assets/app/components/layout/Header.tsx +0 -2
- package/corpus/templates/calendar/app/components/layout/AppLayout.tsx +0 -2
- package/corpus/templates/calendar/app/pages/CalendarView.tsx +0 -2
- package/corpus/templates/chat/app/components/layout/Header.tsx +1 -6
- package/corpus/templates/clips/app/components/layout/Header.tsx +1 -6
- package/corpus/templates/clips/app/hooks/use-library.ts +2 -0
- package/corpus/templates/clips/app/routes/_app.settings._index.tsx +3 -1
- package/corpus/templates/clips/changelog/2026-06-24-archive-and-spaces-navigation-is-more-resilient-when-sidebar.md +6 -0
- package/corpus/templates/content/app/components/layout/Header.tsx +0 -2
- package/corpus/templates/design/app/components/layout/Header.tsx +1 -6
- package/corpus/templates/forms/app/components/layout/Header.tsx +1 -6
- package/corpus/templates/macros/app/components/layout/Header.tsx +1 -6
- package/corpus/templates/mail/app/components/email/CodeBlockLangPicker.tsx +4 -2
- package/corpus/templates/mail/app/components/email/ComposeBubbleToolbar.tsx +18 -12
- package/corpus/templates/mail/app/components/email/ComposeEditor.tsx +9 -5
- package/corpus/templates/mail/app/components/email/ComposeModal.tsx +36 -19
- package/corpus/templates/mail/app/components/email/EmailList.tsx +59 -55
- package/corpus/templates/mail/app/components/email/EmailListItem.tsx +7 -3
- package/corpus/templates/mail/app/components/email/EmailThread.tsx +25 -16
- package/corpus/templates/mail/app/components/email/InlineReplyComposer.tsx +25 -19
- package/corpus/templates/mail/app/components/email/IntegrationsSidebar.tsx +32 -17
- package/corpus/templates/mail/app/components/email/RecipientInput.tsx +26 -10
- package/corpus/templates/mail/app/components/email/SendLaterButton.tsx +5 -3
- package/corpus/templates/mail/app/components/email/SnoozeModal.tsx +4 -2
- package/corpus/templates/mail/app/components/email/SnoozePopover.tsx +9 -5
- package/corpus/templates/mail/app/components/email/extensions/ComposeImageBlock.tsx +4 -2
- package/corpus/templates/mail/app/components/layout/AppLayout.tsx +168 -86
- package/corpus/templates/mail/app/components/layout/SearchBar.tsx +4 -2
- package/corpus/templates/mail/app/i18n/ar-SA.ts +212 -0
- package/corpus/templates/mail/app/i18n/de-DE.ts +212 -0
- package/corpus/templates/mail/app/i18n/en-US.ts +212 -0
- package/corpus/templates/mail/app/i18n/es-ES.ts +212 -0
- package/corpus/templates/mail/app/i18n/fr-FR.ts +212 -0
- package/corpus/templates/mail/app/i18n/hi-IN.ts +212 -0
- package/corpus/templates/mail/app/i18n/ja-JP.ts +212 -0
- package/corpus/templates/mail/app/i18n/ko-KR.ts +212 -0
- package/corpus/templates/mail/app/i18n/pt-BR.ts +212 -0
- package/corpus/templates/mail/app/i18n/zh-CN.ts +211 -0
- package/corpus/templates/mail/app/root.tsx +90 -6
- package/corpus/templates/mail/changelog/2026-06-24-interface-language-support-now-covers-more-mail-controls-and.md +6 -0
- package/corpus/templates/plan/app/components/layout/Header.tsx +1 -6
- package/corpus/templates/slides/app/components/layout/Header.tsx +1 -6
- package/corpus/templates/videos/app/components/layout/Header.tsx +1 -6
- package/dist/client/ErrorBoundary.d.ts.map +1 -1
- package/dist/client/ErrorBoundary.js +128 -7
- package/dist/client/ErrorBoundary.js.map +1 -1
- package/dist/client/FeedbackButton.d.ts.map +1 -1
- package/dist/client/FeedbackButton.js +142 -14
- package/dist/client/FeedbackButton.js.map +1 -1
- package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts.map +1 -1
- package/dist/client/blocks/library/AnnotatedCodeBlock.js +6 -2
- package/dist/client/blocks/library/AnnotatedCodeBlock.js.map +1 -1
- package/dist/client/blocks/library/ApiEndpointBlock.d.ts.map +1 -1
- package/dist/client/blocks/library/ApiEndpointBlock.js +14 -6
- package/dist/client/blocks/library/ApiEndpointBlock.js.map +1 -1
- package/dist/client/blocks/library/MermaidBlock.d.ts.map +1 -1
- package/dist/client/blocks/library/MermaidBlock.js +6 -4
- package/dist/client/blocks/library/MermaidBlock.js.map +1 -1
- package/dist/client/blocks/library/block-copy.d.ts +33 -0
- package/dist/client/blocks/library/block-copy.d.ts.map +1 -0
- package/dist/client/blocks/library/block-copy.js +329 -0
- package/dist/client/blocks/library/block-copy.js.map +1 -0
- package/dist/client/blocks/library/diagram.d.ts.map +1 -1
- package/dist/client/blocks/library/diagram.js +7 -5
- package/dist/client/blocks/library/diagram.js.map +1 -1
- package/dist/client/blocks/library/wireframe.d.ts.map +1 -1
- package/dist/client/blocks/library/wireframe.js +4 -2
- package/dist/client/blocks/library/wireframe.js.map +1 -1
- package/dist/client/i18n.d.ts +1 -0
- package/dist/client/i18n.d.ts.map +1 -1
- package/dist/client/i18n.js +3 -0
- package/dist/client/i18n.js.map +1 -1
- package/docs/content/locales/ar-SA/actions.md +7 -7
- package/docs/content/locales/ar-SA/template-plan.md +6 -4
- package/docs/content/locales/de-DE/actions.md +9 -9
- package/docs/content/locales/de-DE/template-plan.md +6 -4
- package/docs/content/locales/es-ES/actions.md +9 -9
- package/docs/content/locales/es-ES/template-plan.md +6 -4
- package/docs/content/locales/fr-FR/actions.md +9 -9
- package/docs/content/locales/fr-FR/template-plan.md +6 -4
- package/docs/content/locales/hi-IN/actions.md +9 -9
- package/docs/content/locales/hi-IN/template-plan.md +4 -4
- package/docs/content/locales/ja-JP/actions.md +9 -9
- package/docs/content/locales/ja-JP/template-plan.md +4 -4
- package/docs/content/locales/ko-KR/actions.md +9 -9
- package/docs/content/locales/ko-KR/template-plan.md +4 -4
- package/docs/content/locales/pt-BR/actions.md +9 -9
- package/docs/content/locales/pt-BR/template-plan.md +6 -4
- package/docs/content/locales/zh-CN/actions.md +9 -9
- package/docs/content/locales/zh-CN/template-plan.md +4 -4
- package/package.json +1 -1
|
@@ -25,7 +25,7 @@ Codex、Claude コード、Markdown、または構造化された実装計画に
|
|
|
25
25
|
|
|
26
26
|
```an-diagram title="2 つのコマンド、1 つのレビュー サーフェス" summary="どちらのコマンドも、ホストされた Plan MCP コネクタを介して、同じ注釈とコメントのサーフェスにパブリッシュされます。"
|
|
27
27
|
{
|
|
28
|
-
"html": "<div class=\"diagram-plan\"><div class=\"diagram-col\"><div class=\"diagram-node\"><span class=\"diagram-pill accent\">/visual-plan</span><small class=\"diagram-muted\"
|
|
28
|
+
"html": "<div class=\"diagram-plan\"><div class=\"diagram-col\"><div class=\"diagram-node\"><span class=\"diagram-pill accent\">/visual-plan</span><small class=\"diagram-muted\">コード前 — アーキテクチャ、UI、リファクタ</small></div><div class=\"diagram-node\"><span class=\"diagram-pill\">/visual-recap</span><small class=\"diagram-muted\">コード後 — PR、コミット、ブランチ、diff</small></div></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">→</div><div class=\"diagram-panel center\">Plan MCP コネクター<br><small class=\"diagram-muted\">plan.agent-native.com</small></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">→</div><div class=\"diagram-box\">レビュー画面<br><small class=\"diagram-muted\">図 · ワイヤーフレーム · 注釈付きコード · コメント</small></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">↔</div><div class=\"diagram-node\">コーディングエージェント<br><small class=\"diagram-muted\">フィードバックを返却</small></div></div>",
|
|
29
29
|
"css": ".diagram-plan{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.diagram-plan .diagram-col{display:flex;flex-direction:column;gap:10px}.diagram-plan .diagram-arrow{font-size:22px;line-height:1}.diagram-plan .center{display:flex;flex-direction:column;align-items:center;gap:4px;text-align:center}"
|
|
30
30
|
}
|
|
31
31
|
```
|
|
@@ -33,7 +33,7 @@ Codex、Claude コード、Markdown、または構造化された実装計画に
|
|
|
33
33
|
```an-wireframe
|
|
34
34
|
{
|
|
35
35
|
"surface": "desktop",
|
|
36
|
-
"html": "<div style='display:grid;grid-template-columns:1fr 250px;gap:14px;padding:16px;min-height:520px;box-sizing:border-box'><main style='display:flex;flex-direction:column;gap:12px;min-width:0'><div style='display:flex;align-items:center;gap:10px'><h1 style='margin:0'
|
|
36
|
+
"html": "<div style='display:grid;grid-template-columns:1fr 250px;gap:14px;padding:16px;min-height:520px;box-sizing:border-box'><main style='display:flex;flex-direction:column;gap:12px;min-width:0'><div style='display:flex;align-items:center;gap:10px'><h1 style='margin:0'>チェックアウト再設計計画</h1><div style='flex:1'></div><button>共有</button><button class='primary'>承認</button></div><div class='wf-card' style='display:grid;grid-template-columns:1fr 1fr;gap:10px;min-height:150px'><div class='wf-box'>現在のワイヤーフレーム</div><div class='wf-box'>提案ワイヤーフレーム</div></div><div class='wf-card' style='flex:1;display:flex;flex-direction:column;gap:10px'><strong>実装計画</strong><div class='wf-box'>判断:既存のチェックアウトシェルを維持</div><div class='wf-box'>注釈付きコードウォークスルー</div><div class='wf-box'>未解決の質問</div></div></main><aside class='wf-card' style='display:flex;flex-direction:column;gap:10px'><strong>コメント</strong><div class='wf-box'>主要 CTA へのピン</div><div class='wf-box'>エージェントへの質問</div><div class='wf-box'>解決済みコピー注記</div><button class='primary'>フィードバックを返す</button></aside></div>"
|
|
37
37
|
}
|
|
38
38
|
```
|
|
39
39
|
|
|
@@ -569,7 +569,7 @@ const riskCardServerBlock = defineBlock<RiskCardData>({
|
|
|
569
569
|
Read: ServerReadStub,
|
|
570
570
|
placement: ["block"],
|
|
571
571
|
label: "Risk card",
|
|
572
|
-
description: "
|
|
572
|
+
description: "low、medium、high の重大度を持つ markdown のリスクメモ。",
|
|
573
573
|
});
|
|
574
574
|
|
|
575
575
|
export function registerPlanBlocks(registry: BlockRegistry): void {
|
|
@@ -621,7 +621,7 @@ const riskCardBlock = defineBlock<RiskCardData>({
|
|
|
621
621
|
placement: ["block"],
|
|
622
622
|
editSurface: "panel",
|
|
623
623
|
label: "Risk card",
|
|
624
|
-
description: "
|
|
624
|
+
description: "low、medium、high の重大度を持つ markdown のリスクメモ。",
|
|
625
625
|
empty: () => ({ severity: "medium", body: "Describe the risk." }),
|
|
626
626
|
});
|
|
627
627
|
|
|
@@ -85,9 +85,9 @@ actions 정도이며 작업 자체에 필요한 전제 조건은 아닙니다.
|
|
|
85
85
|
"language": "ts",
|
|
86
86
|
"code": "import { defineAction } from \"@agent-native/core/action\";\nimport { z } from \"zod\";\n\nexport default defineAction({\n description: \"Reply to an email thread in the user's voice.\",\n schema: z.object({\n emailId: z.string().describe(\"The id of the email to reply to.\"),\n body: z.string().describe(\"The reply body, in markdown.\"),\n }),\n run: async ({ emailId, body }) => {\n await db.insert(replies).values({ emailId, body });\n return { ok: true, emailId };\n },\n});",
|
|
87
87
|
"annotations": [
|
|
88
|
-
{ "lines": "5", "label": "
|
|
88
|
+
{ "lines": "5", "label": "도구 표면", "note": "`description`은 에이전트가 이 액션을 언제 호출할지 판단하기 위해 읽는 내용입니다. 각 필드의 `.describe()` 호출도 JSON Schema에 들어갑니다." },
|
|
89
89
|
{ "lines": "6-9", "label": "타입 계약", "note": "하나의 schema가 **모든** 표면의 입력을 검증하고 모델용 JSON Schema로 변환합니다. 유효하지 않은 입력은 `run`에 도달하지 않습니다." },
|
|
90
|
-
{ "lines": "10-13", "label": "
|
|
90
|
+
{ "lines": "10-13", "label": "단일 구현", "note": "`run` 본문이 단일 진실 공급원입니다. UI 버튼과 에이전트 도구가 정확히 이것을 실행합니다." }
|
|
91
91
|
]
|
|
92
92
|
}
|
|
93
93
|
```
|
|
@@ -150,19 +150,19 @@ export default defineAction({
|
|
|
150
150
|
|
|
151
151
|
`GET` 작업의 경우 `leadId`는 쿼리 매개변수 `/_agent-native/actions/get-lead?leadId=abc`로 전달됩니다.
|
|
152
152
|
|
|
153
|
-
```an-api title="
|
|
153
|
+
```an-api title="자동 마운트된 action 엔드포인트" method="GET" path="/_agent-native/actions/get-lead"
|
|
154
154
|
{
|
|
155
155
|
"method": "GET",
|
|
156
156
|
"path": "/_agent-native/actions/get-lead",
|
|
157
|
-
"summary": "
|
|
158
|
-
"description": "POST
|
|
159
|
-
"auth": "
|
|
157
|
+
"summary": "모든 action은 여기에 자동으로 마운트됩니다. 파일 이름이 action 이름입니다.",
|
|
158
|
+
"description": "기본값은 POST입니다. `http: { method: \"GET\" }`는 이를 GET으로 만듭니다. React hooks와 `callAction`은 `http.path` override와 관계없이 항상 이름으로 이 경로를 호출합니다.",
|
|
159
|
+
"auth": "세션 쿠키; 프론트엔드 호출에는 `X-Agent-Native-Frontend: 1`이 포함됩니다",
|
|
160
160
|
"params": [
|
|
161
|
-
{ "name": "leadId", "in": "query", "type": "string", "required": true, "description": "GET
|
|
161
|
+
{ "name": "leadId", "in": "query", "type": "string", "required": true, "description": "GET 인수는 query params로 도착하고 POST 인수는 JSON body로 도착합니다." }
|
|
162
162
|
],
|
|
163
163
|
"responses": [
|
|
164
|
-
{ "status": "200", "description": "
|
|
165
|
-
{ "status": "400", "description": "
|
|
164
|
+
{ "status": "200", "description": "action의 반환값을 JSON으로 반환합니다." },
|
|
165
|
+
{ "status": "400", "description": "run()이 실행되기 전에 입력이 schema validation에 실패했습니다." }
|
|
166
166
|
]
|
|
167
167
|
}
|
|
168
168
|
```
|
|
@@ -25,7 +25,7 @@ Codex, Claude 코드, Markdown 또는 구조화된 구현 계획에 붙여넣기
|
|
|
25
25
|
|
|
26
26
|
```an-diagram title="두 개의 명령, 하나의 검토 표면" summary="두 명령 모두 호스팅된 Plan MCP 커넥터를 통해 동일한 주석 및 설명 화면에 게시됩니다."
|
|
27
27
|
{
|
|
28
|
-
"html": "<div class=\"diagram-plan\"><div class=\"diagram-col\"><div class=\"diagram-node\"><span class=\"diagram-pill accent\">/visual-plan</span><small class=\"diagram-muted\"
|
|
28
|
+
"html": "<div class=\"diagram-plan\"><div class=\"diagram-col\"><div class=\"diagram-node\"><span class=\"diagram-pill accent\">/visual-plan</span><small class=\"diagram-muted\">코드 전 — 아키텍처, UI, 리팩터</small></div><div class=\"diagram-node\"><span class=\"diagram-pill\">/visual-recap</span><small class=\"diagram-muted\">코드 후 — PR, 커밋, 브랜치, diff</small></div></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">→</div><div class=\"diagram-panel center\">Plan MCP 커넥터<br><small class=\"diagram-muted\">plan.agent-native.com</small></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">→</div><div class=\"diagram-box\">검토 화면<br><small class=\"diagram-muted\">다이어그램 · 와이어프레임 · 주석 코드 · 댓글</small></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">↔</div><div class=\"diagram-node\">코딩 에이전트<br><small class=\"diagram-muted\">피드백 전달됨</small></div></div>",
|
|
29
29
|
"css": ".diagram-plan{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.diagram-plan .diagram-col{display:flex;flex-direction:column;gap:10px}.diagram-plan .diagram-arrow{font-size:22px;line-height:1}.diagram-plan .center{display:flex;flex-direction:column;align-items:center;gap:4px;text-align:center}"
|
|
30
30
|
}
|
|
31
31
|
```
|
|
@@ -33,7 +33,7 @@ Codex, Claude 코드, Markdown 또는 구조화된 구현 계획에 붙여넣기
|
|
|
33
33
|
```an-wireframe
|
|
34
34
|
{
|
|
35
35
|
"surface": "desktop",
|
|
36
|
-
"html": "<div style='display:grid;grid-template-columns:1fr 250px;gap:14px;padding:16px;min-height:520px;box-sizing:border-box'><main style='display:flex;flex-direction:column;gap:12px;min-width:0'><div style='display:flex;align-items:center;gap:10px'><h1 style='margin:0'
|
|
36
|
+
"html": "<div style='display:grid;grid-template-columns:1fr 250px;gap:14px;padding:16px;min-height:520px;box-sizing:border-box'><main style='display:flex;flex-direction:column;gap:12px;min-width:0'><div style='display:flex;align-items:center;gap:10px'><h1 style='margin:0'>결제 재설계 계획</h1><div style='flex:1'></div><button>공유</button><button class='primary'>승인</button></div><div class='wf-card' style='display:grid;grid-template-columns:1fr 1fr;gap:10px;min-height:150px'><div class='wf-box'>현재 와이어프레임</div><div class='wf-box'>제안 와이어프레임</div></div><div class='wf-card' style='flex:1;display:flex;flex-direction:column;gap:10px'><strong>구현 계획</strong><div class='wf-box'>결정: 기존 결제 셸 유지</div><div class='wf-box'>주석이 달린 코드 워크스루</div><div class='wf-box'>열린 질문</div></div></main><aside class='wf-card' style='display:flex;flex-direction:column;gap:10px'><strong>댓글</strong><div class='wf-box'>기본 CTA에 핀</div><div class='wf-box'>에이전트에게 묻는 질문</div><div class='wf-box'>해결된 문구 메모</div><button class='primary'>피드백 전달</button></aside></div>"
|
|
37
37
|
}
|
|
38
38
|
```
|
|
39
39
|
|
|
@@ -570,7 +570,7 @@ const riskCardServerBlock = defineBlock<RiskCardData>({
|
|
|
570
570
|
Read: ServerReadStub,
|
|
571
571
|
placement: ["block"],
|
|
572
572
|
label: "Risk card",
|
|
573
|
-
description: "
|
|
573
|
+
description: "low, medium, high 심각도를 가진 markdown 위험 메모입니다.",
|
|
574
574
|
});
|
|
575
575
|
|
|
576
576
|
export function registerPlanBlocks(registry: BlockRegistry): void {
|
|
@@ -622,7 +622,7 @@ const riskCardBlock = defineBlock<RiskCardData>({
|
|
|
622
622
|
placement: ["block"],
|
|
623
623
|
editSurface: "panel",
|
|
624
624
|
label: "Risk card",
|
|
625
|
-
description: "
|
|
625
|
+
description: "low, medium, high 심각도를 가진 markdown 위험 메모입니다.",
|
|
626
626
|
empty: () => ({ severity: "medium", body: "Describe the risk." }),
|
|
627
627
|
});
|
|
628
628
|
|
|
@@ -85,9 +85,9 @@ em torno de actions, não é um pré-requisito obrigatório para a ação em si.
|
|
|
85
85
|
"language": "ts",
|
|
86
86
|
"code": "import { defineAction } from \"@agent-native/core/action\";\nimport { z } from \"zod\";\n\nexport default defineAction({\n description: \"Reply to an email thread in the user's voice.\",\n schema: z.object({\n emailId: z.string().describe(\"The id of the email to reply to.\"),\n body: z.string().describe(\"The reply body, in markdown.\"),\n }),\n run: async ({ emailId, body }) => {\n await db.insert(replies).values({ emailId, body });\n return { ok: true, emailId };\n },\n});",
|
|
87
87
|
"annotations": [
|
|
88
|
-
{ "lines": "5", "label": "
|
|
88
|
+
{ "lines": "5", "label": "Superfície da ferramenta", "note": "`description` é o que o agente lê para decidir quando chamar isto. As chamadas `.describe()` de cada campo também entram no JSON Schema." },
|
|
89
89
|
{ "lines": "6-9", "label": "Contrato tipado", "note": "Um schema valida a entrada de **todas** as superfícies e é convertido em JSON Schema para o modelo. Entradas inválidas nunca chegam a `run`." },
|
|
90
|
-
{ "lines": "10-13", "label": "
|
|
90
|
+
{ "lines": "10-13", "label": "Uma implementação", "note": "O corpo de `run` é a fonte única da verdade: o botão da UI e a ferramenta do agente executam exatamente isto." }
|
|
91
91
|
]
|
|
92
92
|
}
|
|
93
93
|
```
|
|
@@ -150,19 +150,19 @@ export default defineAction({
|
|
|
150
150
|
|
|
151
151
|
Para uma ação `GET`, `leadId` é passado como um parâmetro de consulta: `/_agent-native/actions/get-lead?leadId=abc`.
|
|
152
152
|
|
|
153
|
-
```an-api title="
|
|
153
|
+
```an-api title="Endpoint de action montado automaticamente" method="GET" path="/_agent-native/actions/get-lead"
|
|
154
154
|
{
|
|
155
155
|
"method": "GET",
|
|
156
156
|
"path": "/_agent-native/actions/get-lead",
|
|
157
|
-
"summary": "
|
|
158
|
-
"description": "POST
|
|
159
|
-
"auth": "
|
|
157
|
+
"summary": "Cada action e montada aqui automaticamente: o nome do arquivo e o nome da action.",
|
|
158
|
+
"description": "POST por padrao; `http: { method: \"GET\" }` torna a chamada GET. Os hooks React e `callAction` sempre chamam este caminho pelo nome, independentemente de qualquer override de `http.path`.",
|
|
159
|
+
"auth": "Cookie de sessao; chamadas do frontend levam `X-Agent-Native-Frontend: 1`",
|
|
160
160
|
"params": [
|
|
161
|
-
{ "name": "leadId", "in": "query", "type": "string", "required": true, "description": "GET
|
|
161
|
+
{ "name": "leadId", "in": "query", "type": "string", "required": true, "description": "Argumentos GET chegam como query params; argumentos POST chegam no corpo JSON." }
|
|
162
162
|
],
|
|
163
163
|
"responses": [
|
|
164
|
-
{ "status": "200", "description": "
|
|
165
|
-
{ "status": "400", "description": "
|
|
164
|
+
{ "status": "200", "description": "O valor de retorno da action como JSON." },
|
|
165
|
+
{ "status": "400", "description": "A entrada falhou na validacao de schema antes de run() executar." }
|
|
166
166
|
]
|
|
167
167
|
}
|
|
168
168
|
```
|
|
@@ -25,7 +25,7 @@ agente da mesma maneira.
|
|
|
25
25
|
|
|
26
26
|
```an-diagram title="Dois comandos, uma superfície de revisão" summary="Ambos os comandos são publicados por meio do conector do Plano MCP hospedado na mesma superfície de anotação e comentário."
|
|
27
27
|
{
|
|
28
|
-
"html": "<div class=\"diagram-plan\"><div class=\"diagram-col\"><div class=\"diagram-node\"><span class=\"diagram-pill accent\">/visual-plan</span><small class=\"diagram-muted\">
|
|
28
|
+
"html": "<div class=\"diagram-plan\"><div class=\"diagram-col\"><div class=\"diagram-node\"><span class=\"diagram-pill accent\">/visual-plan</span><small class=\"diagram-muted\">antes do codigo: arquitetura, UI, refatoracao</small></div><div class=\"diagram-node\"><span class=\"diagram-pill\">/visual-recap</span><small class=\"diagram-muted\">depois do codigo: PR, commit, branch, diff</small></div></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">→</div><div class=\"diagram-panel center\">Conector MCP do Plan<br><small class=\"diagram-muted\">plan.agent-native.com</small></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">→</div><div class=\"diagram-box\">Superficie de revisao<br><small class=\"diagram-muted\">diagramas · wireframes · codigo anotado · comentarios</small></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">↔</div><div class=\"diagram-node\">Agente de codigo<br><small class=\"diagram-muted\">feedback devolvido</small></div></div>",
|
|
29
29
|
"css": ".diagram-plan{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.diagram-plan .diagram-col{display:flex;flex-direction:column;gap:10px}.diagram-plan .diagram-arrow{font-size:22px;line-height:1}.diagram-plan .center{display:flex;flex-direction:column;align-items:center;gap:4px;text-align:center}"
|
|
30
30
|
}
|
|
31
31
|
```
|
|
@@ -33,7 +33,7 @@ agente da mesma maneira.
|
|
|
33
33
|
```an-wireframe
|
|
34
34
|
{
|
|
35
35
|
"surface": "desktop",
|
|
36
|
-
"html": "<div style='display:grid;grid-template-columns:1fr 250px;gap:14px;padding:16px;min-height:520px;box-sizing:border-box'><main style='display:flex;flex-direction:column;gap:12px;min-width:0'><div style='display:flex;align-items:center;gap:10px'><h1 style='margin:0'>
|
|
36
|
+
"html": "<div style='display:grid;grid-template-columns:1fr 250px;gap:14px;padding:16px;min-height:520px;box-sizing:border-box'><main style='display:flex;flex-direction:column;gap:12px;min-width:0'><div style='display:flex;align-items:center;gap:10px'><h1 style='margin:0'>Plano de redesenho do checkout</h1><div style='flex:1'></div><button>Compartilhar</button><button class='primary'>Aprovar</button></div><div class='wf-card' style='display:grid;grid-template-columns:1fr 1fr;gap:10px;min-height:150px'><div class='wf-box'>Wireframe atual</div><div class='wf-box'>Wireframe proposto</div></div><div class='wf-card' style='flex:1;display:flex;flex-direction:column;gap:10px'><strong>Plano de implementação</strong><div class='wf-box'>Decisão: manter o shell atual do checkout</div><div class='wf-box'>Passo a passo de código anotado</div><div class='wf-box'>Perguntas em aberto</div></div></main><aside class='wf-card' style='display:flex;flex-direction:column;gap:10px'><strong>Comentários</strong><div class='wf-box'>Pin no CTA principal</div><div class='wf-box'>Pergunta para o agente</div><div class='wf-box'>Nota de texto resolvida</div><button class='primary'>Devolver feedback</button></aside></div>"
|
|
37
37
|
}
|
|
38
38
|
```
|
|
39
39
|
|
|
@@ -570,7 +570,8 @@ const riskCardServerBlock = defineBlock<RiskCardData>({
|
|
|
570
570
|
Read: ServerReadStub,
|
|
571
571
|
placement: ["block"],
|
|
572
572
|
label: "Risk card",
|
|
573
|
-
description:
|
|
573
|
+
description:
|
|
574
|
+
"Uma nota de risco em markdown com severidade baixa, média ou alta.",
|
|
574
575
|
});
|
|
575
576
|
|
|
576
577
|
export function registerPlanBlocks(registry: BlockRegistry): void {
|
|
@@ -622,7 +623,8 @@ const riskCardBlock = defineBlock<RiskCardData>({
|
|
|
622
623
|
placement: ["block"],
|
|
623
624
|
editSurface: "panel",
|
|
624
625
|
label: "Risk card",
|
|
625
|
-
description:
|
|
626
|
+
description:
|
|
627
|
+
"Uma nota de risco em markdown com severidade baixa, média ou alta.",
|
|
626
628
|
empty: () => ({ severity: "medium", body: "Describe the risk." }),
|
|
627
629
|
});
|
|
628
630
|
|
|
@@ -85,9 +85,9 @@ pnpm agent "Call hello for Steve and explain the result"
|
|
|
85
85
|
"language": "ts",
|
|
86
86
|
"code": "import { defineAction } from \"@agent-native/core/action\";\nimport { z } from \"zod\";\n\nexport default defineAction({\n description: \"Reply to an email thread in the user's voice.\",\n schema: z.object({\n emailId: z.string().describe(\"The id of the email to reply to.\"),\n body: z.string().describe(\"The reply body, in markdown.\"),\n }),\n run: async ({ emailId, body }) => {\n await db.insert(replies).values({ emailId, body });\n return { ok: true, emailId };\n },\n});",
|
|
87
87
|
"annotations": [
|
|
88
|
-
{ "lines": "5", "label": "
|
|
88
|
+
{ "lines": "5", "label": "工具表面", "note": "`description` 是代理读取以决定何时调用此动作的内容。每个字段的 `.describe()` 也会进入 JSON Schema。" },
|
|
89
89
|
{ "lines": "6-9", "label": "类型化契约", "note": "一个 schema 会验证来自**每个**界面的输入,并转换为供模型使用的 JSON Schema。无效输入永远不会进入 `run`。" },
|
|
90
|
-
{ "lines": "10-13", "label": "
|
|
90
|
+
{ "lines": "10-13", "label": "单一实现", "note": "`run` 主体是唯一事实来源,UI 按钮和代理工具都会执行这一段。" }
|
|
91
91
|
]
|
|
92
92
|
}
|
|
93
93
|
```
|
|
@@ -150,19 +150,19 @@ export default defineAction({
|
|
|
150
150
|
|
|
151
151
|
对于 `GET` 操作,`leadId` 作为查询参数传递:`/_agent-native/actions/get-lead?leadId=abc`。
|
|
152
152
|
|
|
153
|
-
```an-api title="
|
|
153
|
+
```an-api title="自动挂载的 action 端点" method="GET" path="/_agent-native/actions/get-lead"
|
|
154
154
|
{
|
|
155
155
|
"method": "GET",
|
|
156
156
|
"path": "/_agent-native/actions/get-lead",
|
|
157
|
-
"summary": "
|
|
158
|
-
"description": "POST
|
|
159
|
-
"auth": "
|
|
157
|
+
"summary": "每个 action 都会自动挂载在这里 - 文件名就是 action 名称。",
|
|
158
|
+
"description": "默认是 POST;`http: { method: \"GET\" }` 会让它成为 GET。无论任何 `http.path` 覆盖如何,React hooks 和 `callAction` 始终按名称调用这个路径。",
|
|
159
|
+
"auth": "会话 cookie;前端调用会携带 `X-Agent-Native-Frontend: 1`",
|
|
160
160
|
"params": [
|
|
161
|
-
{ "name": "leadId", "in": "query", "type": "string", "required": true, "description": "GET
|
|
161
|
+
{ "name": "leadId", "in": "query", "type": "string", "required": true, "description": "GET 参数以查询参数传入;POST 参数以 JSON body 传入。" }
|
|
162
162
|
],
|
|
163
163
|
"responses": [
|
|
164
|
-
{ "status": "200", "description": "
|
|
165
|
-
{ "status": "400", "description": "
|
|
164
|
+
{ "status": "200", "description": "action 的返回值,以 JSON 表示。" },
|
|
165
|
+
{ "status": "400", "description": "输入在 run() 触发前未通过 schema 验证。" }
|
|
166
166
|
]
|
|
167
167
|
}
|
|
168
168
|
```
|
|
@@ -25,7 +25,7 @@ Codex、Claude 代码、Markdown 或将实施计划粘贴到结构化中
|
|
|
25
25
|
|
|
26
26
|
```an-diagram title="两个命令,一个查看界面" summary="这两个命令都通过托管的 Plan MCP 连接器发布到相同的注释和评论界面。"
|
|
27
27
|
{
|
|
28
|
-
"html": "<div class=\"diagram-plan\"><div class=\"diagram-col\"><div class=\"diagram-node\"><span class=\"diagram-pill accent\">/visual-plan</span><small class=\"diagram-muted\"
|
|
28
|
+
"html": "<div class=\"diagram-plan\"><div class=\"diagram-col\"><div class=\"diagram-node\"><span class=\"diagram-pill accent\">/visual-plan</span><small class=\"diagram-muted\">写代码前 — 架构、UI、重构</small></div><div class=\"diagram-node\"><span class=\"diagram-pill\">/visual-recap</span><small class=\"diagram-muted\">写代码后 — PR、提交、分支、diff</small></div></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">→</div><div class=\"diagram-panel center\">Plan MCP 连接器<br><small class=\"diagram-muted\">plan.agent-native.com</small></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">→</div><div class=\"diagram-box\">审阅界面<br><small class=\"diagram-muted\">图表 · 线框图 · 带注释的代码 · 评论</small></div><div class=\"diagram-arrow diagram-muted\" aria-hidden=\"true\">↔</div><div class=\"diagram-node\">编码代理<br><small class=\"diagram-muted\">反馈已交回</small></div></div>",
|
|
29
29
|
"css": ".diagram-plan{display:flex;align-items:center;gap:12px;flex-wrap:wrap}.diagram-plan .diagram-col{display:flex;flex-direction:column;gap:10px}.diagram-plan .diagram-arrow{font-size:22px;line-height:1}.diagram-plan .center{display:flex;flex-direction:column;align-items:center;gap:4px;text-align:center}"
|
|
30
30
|
}
|
|
31
31
|
```
|
|
@@ -33,7 +33,7 @@ Codex、Claude 代码、Markdown 或将实施计划粘贴到结构化中
|
|
|
33
33
|
```an-wireframe
|
|
34
34
|
{
|
|
35
35
|
"surface": "desktop",
|
|
36
|
-
"html": "<div style='display:grid;grid-template-columns:1fr 250px;gap:14px;padding:16px;min-height:520px;box-sizing:border-box'><main style='display:flex;flex-direction:column;gap:12px;min-width:0'><div style='display:flex;align-items:center;gap:10px'><h1 style='margin:0'
|
|
36
|
+
"html": "<div style='display:grid;grid-template-columns:1fr 250px;gap:14px;padding:16px;min-height:520px;box-sizing:border-box'><main style='display:flex;flex-direction:column;gap:12px;min-width:0'><div style='display:flex;align-items:center;gap:10px'><h1 style='margin:0'>结账改版计划</h1><div style='flex:1'></div><button>分享</button><button class='primary'>批准</button></div><div class='wf-card' style='display:grid;grid-template-columns:1fr 1fr;gap:10px;min-height:150px'><div class='wf-box'>当前线框图</div><div class='wf-box'>拟议线框图</div></div><div class='wf-card' style='flex:1;display:flex;flex-direction:column;gap:10px'><strong>实施计划</strong><div class='wf-box'>决策:保留现有结账外壳</div><div class='wf-box'>带注释的代码演练</div><div class='wf-box'>开放问题</div></div></main><aside class='wf-card' style='display:flex;flex-direction:column;gap:10px'><strong>评论</strong><div class='wf-box'>主 CTA 上的标注</div><div class='wf-box'>给代理的问题</div><div class='wf-box'>已解决的文案备注</div><button class='primary'>交回反馈</button></aside></div>"
|
|
37
37
|
}
|
|
38
38
|
```
|
|
39
39
|
|
|
@@ -569,7 +569,7 @@ const riskCardServerBlock = defineBlock<RiskCardData>({
|
|
|
569
569
|
Read: ServerReadStub,
|
|
570
570
|
placement: ["block"],
|
|
571
571
|
label: "Risk card",
|
|
572
|
-
description: "
|
|
572
|
+
description: "一条 markdown 风险说明,严重级别可为 low、medium 或 high。",
|
|
573
573
|
});
|
|
574
574
|
|
|
575
575
|
export function registerPlanBlocks(registry: BlockRegistry): void {
|
|
@@ -621,7 +621,7 @@ const riskCardBlock = defineBlock<RiskCardData>({
|
|
|
621
621
|
placement: ["block"],
|
|
622
622
|
editSurface: "panel",
|
|
623
623
|
label: "Risk card",
|
|
624
|
-
description: "
|
|
624
|
+
description: "一条 markdown 风险说明,严重级别可为 low、medium 或 high。",
|
|
625
625
|
empty: () => ({ severity: "medium", body: "Describe the risk." }),
|
|
626
626
|
});
|
|
627
627
|
|
package/corpus/core/package.json
CHANGED
|
@@ -9,10 +9,151 @@ import {
|
|
|
9
9
|
isDynamicImportFailureMessage,
|
|
10
10
|
recoverFromStaleChunkError,
|
|
11
11
|
} from "./route-chunk-recovery.js";
|
|
12
|
+
import {
|
|
13
|
+
DEFAULT_LOCALE,
|
|
14
|
+
LOCALE_HYDRATION_GLOBAL,
|
|
15
|
+
LOCALE_STORAGE_KEY,
|
|
16
|
+
normalizeLocaleCode,
|
|
17
|
+
type LocaleCode,
|
|
18
|
+
} from "../localization/shared.js";
|
|
12
19
|
|
|
13
20
|
const homeLinkClassName =
|
|
14
21
|
"mt-6 inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground shadow-sm hover:bg-primary/90 cursor-pointer";
|
|
15
22
|
|
|
23
|
+
const errorCopy: Record<
|
|
24
|
+
LocaleCode,
|
|
25
|
+
{
|
|
26
|
+
loadingLatest: string;
|
|
27
|
+
genericTitle: string;
|
|
28
|
+
genericDetails: string;
|
|
29
|
+
notFoundTitle: string;
|
|
30
|
+
notFoundDetails: string;
|
|
31
|
+
statusTitle: (status: number) => string;
|
|
32
|
+
goHome: string;
|
|
33
|
+
reload: string;
|
|
34
|
+
}
|
|
35
|
+
> = {
|
|
36
|
+
"en-US": {
|
|
37
|
+
loadingLatest: "Loading the latest version...",
|
|
38
|
+
genericTitle: "Something went wrong",
|
|
39
|
+
genericDetails: "An unexpected error occurred.",
|
|
40
|
+
notFoundTitle: "Page not found",
|
|
41
|
+
notFoundDetails: "We couldn't find this page.",
|
|
42
|
+
statusTitle: (status) => `${status} Error`,
|
|
43
|
+
goHome: "Go home",
|
|
44
|
+
reload: "Reload",
|
|
45
|
+
},
|
|
46
|
+
"zh-CN": {
|
|
47
|
+
loadingLatest: "正在加载最新版本...",
|
|
48
|
+
genericTitle: "出错了",
|
|
49
|
+
genericDetails: "发生了意外错误。",
|
|
50
|
+
notFoundTitle: "页面未找到",
|
|
51
|
+
notFoundDetails: "我们找不到这个页面。",
|
|
52
|
+
statusTitle: (status) => `${status} 错误`,
|
|
53
|
+
goHome: "回到首页",
|
|
54
|
+
reload: "重新加载",
|
|
55
|
+
},
|
|
56
|
+
"es-ES": {
|
|
57
|
+
loadingLatest: "Cargando la versión más reciente...",
|
|
58
|
+
genericTitle: "Algo salió mal",
|
|
59
|
+
genericDetails: "Se produjo un error inesperado.",
|
|
60
|
+
notFoundTitle: "Página no encontrada",
|
|
61
|
+
notFoundDetails: "No pudimos encontrar esta página.",
|
|
62
|
+
statusTitle: (status) => `Error ${status}`,
|
|
63
|
+
goHome: "Ir al inicio",
|
|
64
|
+
reload: "Recargar",
|
|
65
|
+
},
|
|
66
|
+
"fr-FR": {
|
|
67
|
+
loadingLatest: "Chargement de la dernière version...",
|
|
68
|
+
genericTitle: "Un problème est survenu",
|
|
69
|
+
genericDetails: "Une erreur inattendue s'est produite.",
|
|
70
|
+
notFoundTitle: "Page introuvable",
|
|
71
|
+
notFoundDetails: "Nous n'avons pas trouvé cette page.",
|
|
72
|
+
statusTitle: (status) => `Erreur ${status}`,
|
|
73
|
+
goHome: "Accueil",
|
|
74
|
+
reload: "Recharger",
|
|
75
|
+
},
|
|
76
|
+
"de-DE": {
|
|
77
|
+
loadingLatest: "Neueste Version wird geladen...",
|
|
78
|
+
genericTitle: "Etwas ist schiefgelaufen",
|
|
79
|
+
genericDetails: "Ein unerwarteter Fehler ist aufgetreten.",
|
|
80
|
+
notFoundTitle: "Seite nicht gefunden",
|
|
81
|
+
notFoundDetails: "Wir konnten diese Seite nicht finden.",
|
|
82
|
+
statusTitle: (status) => `Fehler ${status}`,
|
|
83
|
+
goHome: "Zur Startseite",
|
|
84
|
+
reload: "Neu laden",
|
|
85
|
+
},
|
|
86
|
+
"ja-JP": {
|
|
87
|
+
loadingLatest: "最新バージョンを読み込み中...",
|
|
88
|
+
genericTitle: "問題が発生しました",
|
|
89
|
+
genericDetails: "予期しないエラーが発生しました。",
|
|
90
|
+
notFoundTitle: "ページが見つかりません",
|
|
91
|
+
notFoundDetails: "このページは見つかりませんでした。",
|
|
92
|
+
statusTitle: (status) => `${status} エラー`,
|
|
93
|
+
goHome: "ホームへ",
|
|
94
|
+
reload: "再読み込み",
|
|
95
|
+
},
|
|
96
|
+
"ko-KR": {
|
|
97
|
+
loadingLatest: "최신 버전을 불러오는 중...",
|
|
98
|
+
genericTitle: "문제가 발생했습니다",
|
|
99
|
+
genericDetails: "예기치 않은 오류가 발생했습니다.",
|
|
100
|
+
notFoundTitle: "페이지를 찾을 수 없음",
|
|
101
|
+
notFoundDetails: "이 페이지를 찾을 수 없습니다.",
|
|
102
|
+
statusTitle: (status) => `${status} 오류`,
|
|
103
|
+
goHome: "홈으로 이동",
|
|
104
|
+
reload: "새로고침",
|
|
105
|
+
},
|
|
106
|
+
"pt-BR": {
|
|
107
|
+
loadingLatest: "Carregando a versão mais recente...",
|
|
108
|
+
genericTitle: "Algo deu errado",
|
|
109
|
+
genericDetails: "Ocorreu um erro inesperado.",
|
|
110
|
+
notFoundTitle: "Página não encontrada",
|
|
111
|
+
notFoundDetails: "Não encontramos esta página.",
|
|
112
|
+
statusTitle: (status) => `Erro ${status}`,
|
|
113
|
+
goHome: "Ir para início",
|
|
114
|
+
reload: "Recarregar",
|
|
115
|
+
},
|
|
116
|
+
"hi-IN": {
|
|
117
|
+
loadingLatest: "नवीनतम संस्करण लोड हो रहा है...",
|
|
118
|
+
genericTitle: "कुछ गलत हो गया",
|
|
119
|
+
genericDetails: "एक अनपेक्षित त्रुटि हुई।",
|
|
120
|
+
notFoundTitle: "पेज नहीं मिला",
|
|
121
|
+
notFoundDetails: "हमें यह पेज नहीं मिला।",
|
|
122
|
+
statusTitle: (status) => `${status} त्रुटि`,
|
|
123
|
+
goHome: "होम पर जाएं",
|
|
124
|
+
reload: "रीलोड करें",
|
|
125
|
+
},
|
|
126
|
+
"ar-SA": {
|
|
127
|
+
loadingLatest: "جار تحميل أحدث إصدار...",
|
|
128
|
+
genericTitle: "حدث خطأ ما",
|
|
129
|
+
genericDetails: "حدث خطأ غير متوقع.",
|
|
130
|
+
notFoundTitle: "الصفحة غير موجودة",
|
|
131
|
+
notFoundDetails: "تعذر العثور على هذه الصفحة.",
|
|
132
|
+
statusTitle: (status) => `خطأ ${status}`,
|
|
133
|
+
goHome: "العودة للرئيسية",
|
|
134
|
+
reload: "إعادة التحميل",
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
function readErrorLocale(): LocaleCode {
|
|
139
|
+
if (typeof window === "undefined") return DEFAULT_LOCALE;
|
|
140
|
+
const hydrated = (window as any)[LOCALE_HYDRATION_GLOBAL]?.locale;
|
|
141
|
+
const stored = window.localStorage?.getItem(LOCALE_STORAGE_KEY);
|
|
142
|
+
return (
|
|
143
|
+
normalizeLocaleCode(hydrated) ??
|
|
144
|
+
normalizeLocaleCode(stored) ??
|
|
145
|
+
DEFAULT_LOCALE
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function useErrorCopy() {
|
|
150
|
+
const [locale, setLocale] = useState<LocaleCode>(readErrorLocale);
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
setLocale(readErrorLocale());
|
|
153
|
+
}, []);
|
|
154
|
+
return errorCopy[locale] ?? errorCopy[DEFAULT_LOCALE];
|
|
155
|
+
}
|
|
156
|
+
|
|
16
157
|
function useApplyThemeClass() {
|
|
17
158
|
useEffect(() => {
|
|
18
159
|
const root = document.documentElement;
|
|
@@ -57,16 +198,16 @@ function useStaleChunkRecovery(error: unknown): boolean {
|
|
|
57
198
|
}
|
|
58
199
|
|
|
59
200
|
function UpdatingScreen() {
|
|
201
|
+
const copy = useErrorCopy();
|
|
60
202
|
return (
|
|
61
203
|
<main className="flex items-center justify-center min-h-screen p-4 bg-background text-foreground">
|
|
62
|
-
<p className="text-muted-foreground text-sm">
|
|
63
|
-
Loading the latest version…
|
|
64
|
-
</p>
|
|
204
|
+
<p className="text-muted-foreground text-sm">{copy.loadingLatest}</p>
|
|
65
205
|
</main>
|
|
66
206
|
);
|
|
67
207
|
}
|
|
68
208
|
|
|
69
209
|
function ErrorScreen({ error }: { error: unknown }) {
|
|
210
|
+
const copy = useErrorCopy();
|
|
70
211
|
const recovering = useStaleChunkRecovery(error);
|
|
71
212
|
// While auto-recovering a stale chunk, show a neutral state and skip the
|
|
72
213
|
// console.error below so the transient, self-healing failure does not get
|
|
@@ -74,17 +215,17 @@ function ErrorScreen({ error }: { error: unknown }) {
|
|
|
74
215
|
if (recovering) return <UpdatingScreen />;
|
|
75
216
|
|
|
76
217
|
let status: number | null = null;
|
|
77
|
-
let title =
|
|
78
|
-
let details =
|
|
218
|
+
let title = copy.genericTitle;
|
|
219
|
+
let details = copy.genericDetails;
|
|
79
220
|
let stack: string | undefined;
|
|
80
221
|
|
|
81
222
|
if (isRouteErrorResponse(error)) {
|
|
82
223
|
status = error.status;
|
|
83
224
|
if (error.status === 404) {
|
|
84
|
-
title =
|
|
85
|
-
details =
|
|
225
|
+
title = copy.notFoundTitle;
|
|
226
|
+
details = copy.notFoundDetails;
|
|
86
227
|
} else {
|
|
87
|
-
title =
|
|
228
|
+
title = copy.statusTitle(error.status);
|
|
88
229
|
details = error.statusText || details;
|
|
89
230
|
}
|
|
90
231
|
} else if (error instanceof Error) {
|
|
@@ -122,14 +263,14 @@ function ErrorScreen({ error }: { error: unknown }) {
|
|
|
122
263
|
<h1 className="mt-3 text-2xl font-semibold">{title}</h1>
|
|
123
264
|
<p className="mt-2 text-muted-foreground text-sm">{details}</p>
|
|
124
265
|
<a href={appPath("/")} className={homeLinkClassName}>
|
|
125
|
-
|
|
266
|
+
{copy.goHome}
|
|
126
267
|
</a>
|
|
127
268
|
<button
|
|
128
269
|
type="button"
|
|
129
270
|
onClick={() => window.location.reload()}
|
|
130
271
|
className="mt-3 inline-flex cursor-pointer items-center gap-1.5 rounded-md border border-border bg-background px-4 py-2 text-sm font-medium text-foreground shadow-sm hover:bg-accent"
|
|
131
272
|
>
|
|
132
|
-
|
|
273
|
+
{copy.reload}
|
|
133
274
|
</button>
|
|
134
275
|
{stack && (
|
|
135
276
|
<pre className="mt-6 w-full text-start text-xs overflow-auto p-4 bg-muted rounded">
|