From a0f3f779003c2bee502ceb413993e88aeb876602 Mon Sep 17 00:00:00 2001 From: Aravind Date: Fri, 18 Sep 2026 15:40:35 +0530 Subject: [PATCH] =?UTF-8?q?refactor(ts-migration):=20Phase=2011=20batch=20?= =?UTF-8?q?10=20=E2=80=94=20the=20authoring=20and=20settings=20pages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nine admin pages: `AgentDetail`, both skill editors, the three Workspace pages, `SkillDevelopment`, `Settings` and `Profile`. 9/9 byte-identical, bundle hash unchanged. Six errors, five of them the same shape this phase has met repeatedly: `Object.values(skill.ui || {}).flatMap((page) => page.sections)` yields `unknown` because inference into the union parameter of `values` does not distribute. Three copies of that line across the two editors and `WorkspaceSkills`, plus one `Object.entries` and one `new Set` whose element type reached a React `key`, where `unknown` is not allowed. The sixth is worth its own line. `WorkspaceSkills.toggleSkill` builds a preferences patch as `{ disabledSkills }` and then adds `customSkills` to it conditionally, several lines later, when re-enabling a skill flips an inactive definition back to active. The literal's inferred type does not carry a key assigned after the fact, so the later write looked wrong. The annotation names both keys and marks the conditional one optional, which is what the function does. Measured against `b99dc7c`: typecheck 6 errors, unchanged; no new error anywhere lint exit 0, 0 errors, 289 warnings npm test 1684/1691, the same 7 failures verbatim build exit 0, identical bundle hash 74d17e2d… type erasure 113/113 byte-identical across Phase 11 so far Nine files left in Phase 11, all data pages. No baseline artifact touched — three of those nine are the pages the baselines cover, so the recapture question arrives with the next batch. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01HBG1wnuRfJKCstGB8Fekr8 --- src/pages/admin/{AgentDetail.jsx => AgentDetail.tsx} | 0 .../{OwliverSkillEditor.jsx => OwliverSkillEditor.tsx} | 2 +- src/pages/admin/{Profile.jsx => Profile.tsx} | 0 src/pages/admin/{Settings.jsx => Settings.tsx} | 0 .../admin/{SkillDevelopment.jsx => SkillDevelopment.tsx} | 0 src/pages/admin/{SkillEditor.jsx => SkillEditor.tsx} | 6 +++--- src/pages/admin/{Workspace.jsx => Workspace.tsx} | 0 .../admin/{WorkspaceAgents.jsx => WorkspaceAgents.tsx} | 0 .../admin/{WorkspaceSkills.jsx => WorkspaceSkills.tsx} | 4 ++-- 9 files changed, 6 insertions(+), 6 deletions(-) rename src/pages/admin/{AgentDetail.jsx => AgentDetail.tsx} (100%) rename src/pages/admin/{OwliverSkillEditor.jsx => OwliverSkillEditor.tsx} (99%) rename src/pages/admin/{Profile.jsx => Profile.tsx} (100%) rename src/pages/admin/{Settings.jsx => Settings.tsx} (100%) rename src/pages/admin/{SkillDevelopment.jsx => SkillDevelopment.tsx} (100%) rename src/pages/admin/{SkillEditor.jsx => SkillEditor.tsx} (99%) rename src/pages/admin/{Workspace.jsx => Workspace.tsx} (100%) rename src/pages/admin/{WorkspaceAgents.jsx => WorkspaceAgents.tsx} (100%) rename src/pages/admin/{WorkspaceSkills.jsx => WorkspaceSkills.tsx} (99%) diff --git a/src/pages/admin/AgentDetail.jsx b/src/pages/admin/AgentDetail.tsx similarity index 100% rename from src/pages/admin/AgentDetail.jsx rename to src/pages/admin/AgentDetail.tsx diff --git a/src/pages/admin/OwliverSkillEditor.jsx b/src/pages/admin/OwliverSkillEditor.tsx similarity index 99% rename from src/pages/admin/OwliverSkillEditor.jsx rename to src/pages/admin/OwliverSkillEditor.tsx index bf9b76e..bcf2886 100644 --- a/src/pages/admin/OwliverSkillEditor.jsx +++ b/src/pages/admin/OwliverSkillEditor.tsx @@ -289,7 +289,7 @@ export default function OwliverSkillEditor() { /* The other half of the same definition, when it has one. Read-only: this editor does not own it, but hiding it would misrepresent the skill. */ - const uiSections = Object.values(preview?.ui || {}).flatMap((page) => page.sections || []); + const uiSections = Object.values(preview?.ui || {}).flatMap((page) => page.sections || []); return ( [...new Set(selectedPages.flatMap((p) => surfaceFor(p)?.placements || []))], + () => [...new Set(selectedPages.flatMap((p) => surfaceFor(p)?.placements || []))], [selectedPages] ); @@ -164,7 +164,7 @@ export default function SkillEditor() { /* Every section this definition registers, flattened — the preview reads it for both the type line and the configuration block. */ - const uiSections = Object.values(preview?.ui || {}).flatMap((page) => page.sections || []); + const uiSections = Object.values(preview?.ui || {}).flatMap((page) => page.sections || []); /** * A field edit, written into the definition. @@ -657,7 +657,7 @@ export default function SkillEditor() { UI configuration
- {Object.entries(preview.ui).map(([page, config]) => ( + {Object.entries(preview.ui).map(([page, config]) => (

{surfaceFor(page)?.label || page} diff --git a/src/pages/admin/Workspace.jsx b/src/pages/admin/Workspace.tsx similarity index 100% rename from src/pages/admin/Workspace.jsx rename to src/pages/admin/Workspace.tsx diff --git a/src/pages/admin/WorkspaceAgents.jsx b/src/pages/admin/WorkspaceAgents.tsx similarity index 100% rename from src/pages/admin/WorkspaceAgents.jsx rename to src/pages/admin/WorkspaceAgents.tsx diff --git a/src/pages/admin/WorkspaceSkills.jsx b/src/pages/admin/WorkspaceSkills.tsx similarity index 99% rename from src/pages/admin/WorkspaceSkills.jsx rename to src/pages/admin/WorkspaceSkills.tsx index 1233745..d58cbcb 100644 --- a/src/pages/admin/WorkspaceSkills.jsx +++ b/src/pages/admin/WorkspaceSkills.tsx @@ -86,7 +86,7 @@ const surfaceLabels = (skill) => */ function contribution(skill, facet) { if (facet === 'ui') { - const sections = Object.values(skill.ui || {}).flatMap((page) => page.sections || []); + const sections = Object.values(skill.ui || {}).flatMap((page) => page.sections || []); return { type: [...new Set(sections.map((s) => sectionTypeLabel(s.type)))].join(' · '), detail: [...new Set(sections.map((s) => placementLabel(s.placement)))].join(', '), @@ -297,7 +297,7 @@ export default function WorkspaceSkills() { */ const toggleSkill = (id, enabled) => { const skill = skills.find((s) => s.id === id); - const patch = { + const patch: { disabledSkills: any; customSkills?: any } = { disabledSkills: enabled ? disabledSkills.filter((s) => s !== id) : [...new Set([...disabledSkills, id])],