Skip to content

feat: add global worker agent templates and improve agent config ui#1351

Open
claytonlin1110 wants to merge 5 commits intoeigent-ai:mainfrom
claytonlin1110:feat/global-worker-agent-templates-agent-config-ui
Open

feat: add global worker agent templates and improve agent config ui#1351
claytonlin1110 wants to merge 5 commits intoeigent-ai:mainfrom
claytonlin1110:feat/global-worker-agent-templates-agent-config-ui

Conversation

@claytonlin1110
Copy link
Copy Markdown
Contributor

@claytonlin1110 claytonlin1110 commented Feb 23, 2026

Related Issue

Closes #1345
Context: Worker agents are already user-scoped (stored per user in the app and shared across all projects). This PR adds file-based global templates so you can keep a reusable library of agent configs that survives cleared app data and can be backed up or moved between machines, plus UI improvements for managing and reusing them.

Description

Feature 1: Global Worker Agent templates

  • Store global templates in ~/.eigent//agent-templates.json (Electron).
  • New Agents → Global Agents tab: list templates, import from JSON, export, duplicate, delete.
  • When adding a Worker: Create from template dropdown and Save as global template checkbox so templates are reusable across projects.

Feature 2: Agent configuration UI

  • Export / Import agent config (JSON) from the Add Worker dialog.
  • Duplicate for global templates (in Global Agents) and for workers (workflow node menu).
  • Larger, resizable description (system prompt) field.
  • Tools overview: summary of selected tools under the tool selector.

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Contribution Guidelines Acknowledgement

@claytonlin1110 claytonlin1110 force-pushed the feat/global-worker-agent-templates-agent-config-ui branch 2 times, most recently from f87f471 to ceb95f0 Compare March 2, 2026 18:09
@claytonlin1110
Copy link
Copy Markdown
Contributor Author

@Wendong-Fan @a7m-1st @Pakchoioioi Please review this PR when you have a chance.

@claytonlin1110
Copy link
Copy Markdown
Contributor Author

@4pmtong Would you please review this?

@claytonlin1110
Copy link
Copy Markdown
Contributor Author

Anyone can review this PR? Thanks.

@a7m-1st
Copy link
Copy Markdown
Collaborator

a7m-1st commented Mar 3, 2026

Thanks for the PR @claytonlin1110 , it seems a medium size PR. Do you mind attaching some videos or screenshots of your exact changes so that we can have an easy time to assess beforehand?

Depending on that if it's a core user flow feature, we might need to update the docs too.

Thanks for that !

@claytonlin1110 claytonlin1110 force-pushed the feat/global-worker-agent-templates-agent-config-ui branch from ceb95f0 to abf4426 Compare March 4, 2026 04:00
@claytonlin1110
Copy link
Copy Markdown
Contributor Author

claytonlin1110 commented Mar 4, 2026

Global Agents tab

global.mp4

Create from template and save as global template

create_from_template.mp4

Export / Import agent config (Add Worker)

export_import_agent_config.mp4

@claytonlin1110
Copy link
Copy Markdown
Contributor Author

@a7m-1st Uploaded video.

@a7m-1st
Copy link
Copy Markdown
Collaborator

a7m-1st commented Mar 4, 2026

Awesome thanks @claytonlin1110 , I have forwarded the PR to @Pakchoioioi and @Douglasymlai to align the features and UI/UX

@Douglasymlai
Copy link
Copy Markdown
Contributor

Hi @claytonlin1110 thanks for this PR. I will have a meeting with @Pakchoioioi this week go through this feature, since it's a big update to the project structure. We will get back to you ASAP.

@claytonlin1110
Copy link
Copy Markdown
Contributor Author

@Douglasymlai @Pakchoioioi Any update?

@claytonlin1110
Copy link
Copy Markdown
Contributor Author

@Douglasymlai Please let me know if you have any update for this. Wanna get this PR reviewed asap. Thanks.

@claytonlin1110
Copy link
Copy Markdown
Contributor Author

@a7m-1st Please let me know how you can split this into smaller features/PRs

@a7m-1st
Copy link
Copy Markdown
Collaborator

a7m-1st commented Apr 2, 2026

  • This modal is barely hanging, now you are proposing even more secondary fields. There should have been a more elegant way I believe.
  • For instance export should never be visible before creating an Agent.
  • Create from template & import agent config could have been outside this modal. Does that mean users need to copy & paste Agent config to every modal one by one?
  • Advanced Model config is not clear at all; perhaps it should have been hidden if using cloud model?
image

Copy link
Copy Markdown
Collaborator

@a7m-1st a7m-1st left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @claytonlin1110 ; I just wish more effort was put on proposing a design and discussing with the internal team before commencing. The issue creator was not an internal member thus he suggested some non-existent issues.

This PR adds around 800 more lines but resolves a non fruitful part of the issue. Here:

 What it does solve:                                                        
                                                                             
  - It adds global reusable templates                                          
  - It adds “save as global template” and “create from template” in the      
    worker modal                 
  - It adds export/import for agent config in the same modal, plus duplicate 
    for workers and templates.                                               
                                                                             
  What it does not solve:                                                    
                                                                             
  - It does not make workers themselves global and directly usable across    
    projects. It adds global templates, not global live agents. You still    
    create project-scoped workers from those templates.                      
  - It does not provide a dedicated full-screen agent editor. Editing is     
    still done in the small modal.     
  - It does not provide central editing of all fields from the Global Agents 
    page. That page is mostly list/import/export/duplicate/delete, not a full    edit surface.                                                            
  - It does not appear to cover “skills” as part of the template payload. The
    stored template shape in src/store/globalAgentTemplatesStore.ts only     
    includes name, description, tools, mcp_tools, and optional               
    custom_model_config.                                                     
  - It does not implement “attach selected global agents to a project” as a  
    separate flow, nor “call global agents directly from an orchestrator”.   
                                                                             
  And per the review, some implemented features are currently broken:        
                                                                             
  - Template creation/import does not restore selected tools in src/
    components/AddWorker/index.tsx.                                          
  - Duplicate worker names collide in src/components/WorkFlow/node.tsx, which
    can break later edit/delete behavior. 

Comment thread src/pages/Agents/GlobalAgents.tsx Outdated
@a7m-1st
Copy link
Copy Markdown
Collaborator

a7m-1st commented Apr 2, 2026

After reviewing I don't think we can salvage anything from this @claytonlin1110 because of those main issues (In addition to the non existent problem):

  • The current duplicate-worker action in src/components/WorkFlow/node.tsx.
    It creates identity collisions and is structurally unsafe.
  • The current import/export implementation as shipped. Round-trip
    correctness matters more than having the button.

I will be waiting for your justification but for now I will be closing this PR and it's related issue.

Thanks for your utmost attention.

@claytonlin1110
Copy link
Copy Markdown
Contributor Author

@a7m-1st Would you please reopen this PR? so that i can update ?

@a7m-1st a7m-1st reopened this Apr 2, 2026
@a7m-1st
Copy link
Copy Markdown
Collaborator

a7m-1st commented Apr 2, 2026

okay, But can you tell us what?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for file-backed, user-scoped global Worker Agent templates in the Electron app and improves the agent configuration UX (templates, import/export, duplication, and better prompt/tools UI).

Changes:

  • Add Electron IPC + preload API for loading/saving agent-templates.json under ~/.eigent/<userId>/.
  • Add a new “Global Agents” tab with import/export/duplicate/delete for templates and a Zustand store for template persistence.
  • Enhance the Add Worker dialog (create-from-template, save-as-template, import/export config, larger prompt editor, selected-tools summary) and add a duplicate action from workflow nodes.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 13 comments.

Show a summary per file
File Description
src/types/electron.d.ts Adds typings for new agentTemplatesLoad/Save Electron APIs.
src/store/globalAgentTemplatesStore.ts Introduces Zustand store + types for global agent templates with Electron persistence.
src/pages/Agents/index.tsx Adds “Global Agents” navigation tab and renders the new page.
src/pages/Agents/GlobalAgents.tsx Implements UI for listing and managing global templates (import/export/duplicate/delete).
src/i18n/locales/en-us/workforce.json Adds strings for agent duplicate/export/import actions.
src/i18n/locales/en-us/agents.json Adds strings for Global Agents UI.
src/components/WorkFlow/node.tsx Adds “Duplicate” action for worker nodes.
src/components/AddWorker/index.tsx Adds create-from-template, save-as-template, import/export config, resizable prompt, tool summary.
electron/preload/index.ts Exposes new IPC-backed template APIs to the renderer.
electron/main/index.ts Implements IPC handlers and filesystem read/write for agent-templates.json.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/store/globalAgentTemplatesStore.ts Outdated
Comment on lines +63 to +103
function hasAgentTemplatesApi(): boolean {
return (
typeof window !== 'undefined' &&
!!(window as unknown as { electronAPI?: { agentTemplatesLoad?: unknown } })
.electronAPI?.agentTemplatesLoad
);
}

export const useGlobalAgentTemplatesStore = create<GlobalAgentTemplatesState>()(
(set, get) => ({
templates: [],
isLoading: false,

loadTemplates: async () => {
if (!hasAgentTemplatesApi()) return;
const userId = emailToUserId(useAuthStore.getState().email);
if (!userId) return;
set({ isLoading: true });
try {
const result = await window.electronAPI.agentTemplatesLoad(userId);
if (result.success && result.templates) {
set({ templates: result.templates });
}
} catch (error) {
console.error('[GlobalAgentTemplates] Load failed:', error);
} finally {
set({ isLoading: false });
}
},

saveTemplates: async (templates: GlobalAgentTemplate[]) => {
if (!hasAgentTemplatesApi()) return false;
const userId = emailToUserId(useAuthStore.getState().email);
if (!userId) return false;
try {
const result = await window.electronAPI.agentTemplatesSave(
userId,
templates
);
if (result.success) set({ templates });
return result.success ?? false;
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasAgentTemplatesApi() only checks for electronAPI.agentTemplatesLoad, but saveTemplates() calls electronAPI.agentTemplatesSave. If the preload/main process is out of sync (or partially mocked), this can still throw at runtime. Consider updating the capability check (or saveTemplates) to verify both agentTemplatesLoad and agentTemplatesSave exist before using them.

Copilot uses AI. Check for mistakes.
Comment thread src/store/globalAgentTemplatesStore.ts Outdated
Comment on lines +32 to +37
custom_model_config?: {
model_platform?: string;
model_type?: string;
api_key?: string;
api_url?: string;
extra_params?: Record<string, unknown>;
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GlobalAgentTemplate.custom_model_config includes api_key/api_url, and templates are persisted to ~/.eigent/<userId>/agent-templates.json. This makes it easy to accidentally write secrets to disk and export them. Consider explicitly omitting secret fields when saving/exporting templates (or warning the user / storing secrets in the system keychain instead).

Suggested change
custom_model_config?: {
model_platform?: string;
model_type?: string;
api_key?: string;
api_url?: string;
extra_params?: Record<string, unknown>;
/**
* Non-sensitive model configuration that may be safely persisted/exported.
* Secrets such as API keys and private URLs must NOT be included here.
*/
custom_model_config?: {
model_platform?: string;
model_type?: string;
extra_params?: Record<string, unknown>;
};
/**
* Sensitive model configuration. This should be kept in memory or a secure
* credential store and must not be written to disk alongside templates.
*/
custom_model_secrets?: {
api_key?: string;
api_url?: string;

Copilot uses AI. Check for mistakes.
Comment thread src/pages/Agents/GlobalAgents.tsx Outdated
Comment on lines +213 to +215
onClick={() => {
duplicateTemplate(template.id);
toast.success(t('agents.skill-added-success'));
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicateTemplate() is async, but it’s invoked without await and the UI always shows a success toast. If persistence fails, users will still see “success”. Consider awaiting the promise and showing success/failure based on the return value.

Suggested change
onClick={() => {
duplicateTemplate(template.id);
toast.success(t('agents.skill-added-success'));
onClick={async () => {
try {
await duplicateTemplate(template.id);
toast.success(t('agents.skill-added-success'));
} catch (error) {
toast.error(t('agents.skill-added-failed'));
}

Copilot uses AI. Check for mistakes.
Comment thread src/pages/Agents/GlobalAgents.tsx Outdated
Comment on lines +115 to +118
if (ok) toast.success(t('agents.skill-added-success'));
else toast.error(t('agents.skill-add-error'));
} catch (err) {
toast.error(t('agents.skill-add-error'));
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page still uses skill-related i18n keys/toasts/dialog text (e.g., agents.skill-added-success, agents.delete-skill*, agents.skill-deleted-success) for Global Agent templates. This will display incorrect messaging (“Skill”) in the Global Agents UI. Introduce template-specific i18n keys (or reuse an existing generic success/error pattern) and update these calls accordingly.

Suggested change
if (ok) toast.success(t('agents.skill-added-success'));
else toast.error(t('agents.skill-add-error'));
} catch (err) {
toast.error(t('agents.skill-add-error'));
if (ok)
toast.success(
t('agents.template-import-success', {
defaultValue: 'Template imported successfully.',
})
);
else
toast.error(
t('agents.template-import-error', {
defaultValue: 'Failed to import template.',
})
);
} catch (err) {
toast.error(
t('agents.template-import-error', {
defaultValue: 'Failed to import template.',
})
);

Copilot uses AI. Check for mistakes.
Comment thread src/pages/Agents/GlobalAgents.tsx Outdated
const name = data.name ?? 'Imported';
const template: GlobalAgentTemplate = {
id: `tpl_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`,
name: data.name ?? 'Imported',
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const name = data.name ?? 'Imported'; is declared but never used, which will trigger @typescript-eslint/no-unused-vars warnings. Remove it or use it when building the imported template.

Suggested change
name: data.name ?? 'Imported',
name,

Copilot uses AI. Check for mistakes.
Comment thread src/components/AddWorker/index.tsx Outdated
Comment on lines +198 to +203
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `agent-${workerName || 'config'}.json`;
a.click();
URL.revokeObjectURL(url);
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The exported filename uses the raw workerName (agent-${workerName}.json). If the name contains characters invalid for filenames (e.g. / or :), the download name can be mangled by the browser/OS. Consider sanitizing workerName similar to GlobalAgents.exportTemplate().

Copilot uses AI. Check for mistakes.
Comment thread src/components/AddWorker/index.tsx Outdated
Comment on lines +547 to +554
await addGlobalTemplate({
name: workerName,
description: workerDescription,
tools: localTool,
mcp_tools: mcpLocal,
custom_model_config: customModelConfig,
});
toast.success(t('agents.skill-added-success'));
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When “Save as global template” is checked, the code always shows a success toast even if addGlobalTemplate() fails (it returns null on failure). Consider checking the return value and showing a failure toast/message when persistence fails.

Suggested change
await addGlobalTemplate({
name: workerName,
description: workerDescription,
tools: localTool,
mcp_tools: mcpLocal,
custom_model_config: customModelConfig,
});
toast.success(t('agents.skill-added-success'));
const result = await addGlobalTemplate({
name: workerName,
description: workerDescription,
tools: localTool,
mcp_tools: mcpLocal,
custom_model_config: customModelConfig,
});
if (result) {
toast.success(t('agents.skill-added-success'));
} else {
toast.error(t('agents.skill-added-failed'));
}

Copilot uses AI. Check for mistakes.
Comment thread src/components/WorkFlow/node.tsx Outdated
Comment on lines +466 to +488
const base = data.agent as Agent;
const copyName = `${base.workerInfo?.name ?? base.name} (copy)`;
const newWorker: Agent = {
tasks: [],
agent_id: copyName,
name: copyName,
type: copyName as AgentNameType,
log: [],
tools: base.tools ?? [],
activeWebviewIds: [],
workerInfo: {
name: copyName,
description:
base.workerInfo?.description ?? '',
tools: base.workerInfo?.tools ?? [],
mcp_tools: base.workerInfo?.mcp_tools ?? {
mcpServers: {},
},
selectedTools:
base.workerInfo?.selectedTools ?? [],
},
};
setWorkerList([...workerList, newWorker]);
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The duplicate-worker action bypasses the AddWorker name uniqueness check. Duplicating the same worker multiple times will create identical name/type/agent_id values (e.g. “X (copy)” repeated), which can break code paths that assume type is unique (e.g. edit/delete lookups). Consider generating a unique name (incrementing suffix) or reusing the existing validation/rename flow before inserting into workerList.

Copilot uses AI. Check for mistakes.
Comment on lines +71 to +149
export const useGlobalAgentTemplatesStore = create<GlobalAgentTemplatesState>()(
(set, get) => ({
templates: [],
isLoading: false,

loadTemplates: async () => {
if (!hasAgentTemplatesApi()) return;
const userId = emailToUserId(useAuthStore.getState().email);
if (!userId) return;
set({ isLoading: true });
try {
const result = await window.electronAPI.agentTemplatesLoad(userId);
if (result.success && result.templates) {
set({ templates: result.templates });
}
} catch (error) {
console.error('[GlobalAgentTemplates] Load failed:', error);
} finally {
set({ isLoading: false });
}
},

saveTemplates: async (templates: GlobalAgentTemplate[]) => {
if (!hasAgentTemplatesApi()) return false;
const userId = emailToUserId(useAuthStore.getState().email);
if (!userId) return false;
try {
const result = await window.electronAPI.agentTemplatesSave(
userId,
templates
);
if (result.success) set({ templates });
return result.success ?? false;
} catch (error) {
console.error('[GlobalAgentTemplates] Save failed:', error);
return false;
}
},

addTemplate: async (template) => {
const tpl: GlobalAgentTemplate = {
...template,
id: generateId(),
updatedAt: Date.now(),
mcp_tools: template.mcp_tools ?? { mcpServers: {} },
};
const templates = [...get().templates, tpl];
const ok = await get().saveTemplates(templates);
return ok ? tpl : null;
},

updateTemplate: async (id: string, patch: Partial<GlobalAgentTemplate>) => {
const templates = get().templates.map((t) =>
t.id === id ? { ...t, ...patch, updatedAt: Date.now() } : t
);
return get().saveTemplates(templates);
},

removeTemplate: async (id: string) => {
const templates = get().templates.filter((t) => t.id !== id);
return get().saveTemplates(templates);
},

duplicateTemplate: async (id: string) => {
const t = get().templates.find((x) => x.id === id);
if (!t) return null;
const copy: GlobalAgentTemplate = {
...JSON.parse(JSON.stringify(t)),
id: generateId(),
name: `${t.name} (copy)`,
updatedAt: Date.now(),
};
const templates = [...get().templates, copy];
const ok = await get().saveTemplates(templates);
return ok ? copy : null;
},

getTemplate: (id: string) => get().templates.find((t) => t.id === id),
})
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is existing unit test coverage for Zustand stores (e.g. test/unit/store/chatStore.test.ts), but the new globalAgentTemplatesStore introduces non-trivial behavior (load/save/add/duplicate/remove and Electron API gating) without tests. Consider adding unit tests for the store’s CRUD behavior and its handling when the Electron API is unavailable.

Copilot uses AI. Check for mistakes.
Comment thread src/pages/Agents/GlobalAgents.tsx Outdated
Comment on lines +239 to +257
<AlertDialog
isOpen={deleteId !== null}
onClose={() => setDeleteId(null)}
onConfirm={async () => {
if (deleteId) {
await removeTemplate(deleteId);
setDeleteId(null);
toast.success(t('agents.skill-deleted-success'));
}
}}
title={t('agents.delete-skill')}
message={t('agents.delete-skill-confirmation', {
name: deleteId
? (templates.find((x) => x.id === deleteId)?.name ?? '')
: '',
})}
confirmText={t('layout.delete')}
cancelText={t('workforce.cancel')}
/>
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The delete confirmation dialog uses skill-specific i18n keys (agents.delete-skill, agents.delete-skill-confirmation, agents.skill-deleted-success). This will show “Skill” wording when deleting templates. Consider adding agents.delete-template* keys (or similar) and using those here.

Copilot uses AI. Check for mistakes.
@a7m-1st a7m-1st marked this pull request as draft April 2, 2026 05:40
@claytonlin1110
Copy link
Copy Markdown
Contributor Author

@a7m-1st
(1) make templates persist selected_tools_snapshot so tool picks round-trip on create-from-template / import / export;
(2) duplicate worker uses unique names ((copy), (copy 2), …) so edit/delete by type doesn’t collide;
(3) import validates JSON + correct toasts;
(4) import button styling / no false "disabled" while loading.

@claytonlin1110 claytonlin1110 requested a review from a7m-1st April 3, 2026 08:14
@claytonlin1110
Copy link
Copy Markdown
Contributor Author

@a7m-1st would you please review again?

@claytonlin1110 claytonlin1110 marked this pull request as ready for review April 3, 2026 08:17
@claytonlin1110
Copy link
Copy Markdown
Contributor Author

@a7m-1st This PR has been a few months.. Would you please review again?

@claytonlin1110
Copy link
Copy Markdown
Contributor Author

@a7m-1st Had a chance to review again?

@a7m-1st
Copy link
Copy Markdown
Collaborator

a7m-1st commented Apr 17, 2026

Hi there @claytonlin1110 apologies I saw your messages this week. Just that I was quite occupied this week. Let me make room tmrw. Thanks!

@a7m-1st
Copy link
Copy Markdown
Collaborator

a7m-1st commented Apr 17, 2026

But did you already resolve all copilot reviews?

@claytonlin1110 claytonlin1110 force-pushed the feat/global-worker-agent-templates-agent-config-ui branch from f6d3f2d to 298f03b Compare April 17, 2026 20:39
@claytonlin1110
Copy link
Copy Markdown
Contributor Author

@a7m-1st Yes all resolved

@a7m-1st
Copy link
Copy Markdown
Collaborator

a7m-1st commented Apr 19, 2026

Hi there @claytonlin1110 ; after a quick review here is my comments again. I can't find anything to salvage, so most likely will strip all the features of this PR 🥲. I am being very linient about it; so is my verdict okay? It won't resemble your original PR and definately won't solve the original issue:

  1. Electron IPC for Template Persistence

Files: electron/main/index.ts, electron/preload/index.ts, src/types/electron.d.ts
Verdict: CLEAN — Proper structure, versioning, error handling. Minor issue: any types should be properly typed.
▎ Keep?

  1. Zustand Store (globalAgentTemplatesStore.ts) — 338 lines
    Verdict: Mixed — Good validation/sanitization logic, but:
  • No error state
  • JSON.parse(JSON.stringify()) for deep cloning
  • Duplicate emailToUserId() utility
  • Race conditions on concurrent saves
  • No tests
    ▎ Keep the structure, simplify heavily?
  1. GlobalAgents Page (GlobalAgents.tsx) — 259 lines
    Verdict: Questionable — New tab for viewing/importing/exporting/duplicating templates. But:
  • Uses wrong i18n keys (skill-related instead of template-specific)
  • Missing error handling on duplicate/delete
  • Was the main thing reviewers pushed back on (design not aligned)
    ▎ Drop entirely? Or keep a simplified version?
  1. AddWorker Dialog Changes — grew from ~500 to 927 lines

Verdict: Overcrowded — Added template loading, export, "save as global template" checkbox, custom model config UI. Issues:

  • 16 separate useState calls
  • Debug console.log leftovers
  • Custom model config logic repeated 3 times
  • Hardcoded special cases for specific tools
  • Modal now does too much (reviewer feedback)
    ▎ Strip back to essentials? What do you actually want in the modal?
  1. Duplicate Worker (WorkFlow/node.tsx)
    Verdict: Decent — nextUniqueCustomWorkerName() is well-written. But:
  • Pulls from potentially stale node data
  • Scroll logic got fragile with magic numbers
    ▎ Keep duplicate feature, clean up scroll logic?
  1. Home.tsx Changes — ~250 lines of duplicated JSX
    Verdict: Messy — Two identical button groups for template dropdown. Should be one extracted component.
    ▎ Keep the concept, extract to component?

  2. i18n Changes — All locales
    Verdict: Mostly fine but some keys are misnamed (skill vs template).
    ▎ Fix key names to match what we keep.

@claytonlin1110
Copy link
Copy Markdown
Contributor Author

@a7m-1st
Thanks for the thorough pass - your verdict is okay.

I agree this PR drifted too broad. Let's salvage only the minimal path to fix the original problem and drop the rest.

Proposed keep/drop:

1.Keep Electron IPC template persistence (electron/main, preload, electron.d.ts) with typed payload cleanups.
2.Keep (simplified) Zustand store as a thin persistence layer (load/save/validate/sanitize), remove deep-clone hack, remove duplicated helper, add basic error state, and avoid concurrent save races.
3.Drop for now the large UI expansions (GlobalAgents heavy flows, AddWorker template UX overload, Home duplicated dropdown UI).
4.Keep duplicate worker naming helper, but clean fragile scroll behavior separately.
5.Fix i18n naming consistency (template vs skill keys) only for surviving UI.

So yes - it won’t resemble the original PR, but I’m okay with that if we land a small, reliable base and iterate in follow-ups.

@claytonlin1110
Copy link
Copy Markdown
Contributor Author

@a7m-1st I updated PR. please review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Global Worker Agent templates & more friendly Agent configuration UI

4 participants