Skip to content

Sync Agents to Console#837

Open
fathah wants to merge 1 commit into
mainfrom
sync-agents-to-console
Open

Sync Agents to Console#837
fathah wants to merge 1 commit into
mainfrom
sync-agents-to-console

Conversation

@fathah

@fathah fathah commented Jul 9, 2026

Copy link
Copy Markdown
Owner

No description provided.

@greptile-apps

greptile-apps Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a profile-level path for syncing agents to Hermes One. The main changes are:

  • New Sync tab in the profile modal.
  • Linked-agent lookup exposed through IPC and preload.
  • Hermes API URL normalization for remote http:// account URLs.
  • Dev .env loading for main-process runtime config.
  • Tests, docs, styles, and i18n for the new sync flow.

Confidence Score: 5/5

This looks safe to merge after a small cleanup to the linked-agent IPC lookup.

  • The URL normalization and dev environment changes match the account and sync callers.
  • The new Sync pane uses the same profile id shape as sync outcomes.
  • Invalid profile input can reject the new linked-agent lookup instead of returning an unlinked state.

src/main/ipc/register.ts

Important Files Changed

Filename Overview
src/main/api-url.ts Adds shared API URL trimming and remote http:// to https:// normalization.
src/main/hermes-account.ts Updates API URL and key resolution to prefer runtime environment values before baked values.
src/main/account-store.ts Normalizes stored account API URLs on read so older remote http:// URLs are corrected.
src/main/load-env.ts Adds best-effort dev-only .env loading into process.env.
src/main/index.ts Loads dev environment values before main-process startup.
src/main/ipc/register.ts Adds the sync run/status linked-id IPC surface; invalid linked-id profile input can currently reject.
src/preload/index.ts Exposes getLinkedAgentId(profile) through the preload bridge.
src/preload/index.d.ts Adds the renderer-facing type for linked-agent lookup.
src/renderer/src/components/profile/ProfileSyncPane.tsx Adds the per-profile Sync pane with status refresh, linked state, warnings, and sync triggering.
src/renderer/src/components/profile/ProfileModal.tsx Adds the Sync section to the profile modal.
src/renderer/src/components/profile/ProfileSyncPane.test.tsx Adds coverage for signed-out state, linked state, per-profile outcome display, and sync button behavior.
src/renderer/src/assets/main.css Adds styling for the profile Sync tab.
src/shared/i18n/locales/en/agents.ts Adds English labels for the Sync tab and sync action states.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
  participant UI as ProfileSyncPane
  participant Preload as window.hermesAPI
  participant IPC as Main IPC
  participant Sync as agent-sync
  participant Account as account-store
  UI->>Preload: getAgentSyncStatus()
  Preload->>IPC: agent-sync-status
  IPC->>Sync: getAgentSyncStatus()
  Sync-->>UI: status
  UI->>Preload: getLinkedAgentId(profile)
  Preload->>IPC: agent-sync-linked-id(profile)
  IPC->>Sync: getLinkedAgentId(profile)
  Sync-->>UI: agentId or null
  UI->>Preload: syncAgents()
  Preload->>IPC: agent-sync-run
  IPC->>Sync: syncAgents()
  Sync->>Account: getAccount()
  Account-->>Sync: normalized apiUrl
  Sync-->>IPC: AgentSyncResult
  IPC-->>UI: agent-sync-updated
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
  participant UI as ProfileSyncPane
  participant Preload as window.hermesAPI
  participant IPC as Main IPC
  participant Sync as agent-sync
  participant Account as account-store
  UI->>Preload: getAgentSyncStatus()
  Preload->>IPC: agent-sync-status
  IPC->>Sync: getAgentSyncStatus()
  Sync-->>UI: status
  UI->>Preload: getLinkedAgentId(profile)
  Preload->>IPC: agent-sync-linked-id(profile)
  IPC->>Sync: getLinkedAgentId(profile)
  Sync-->>UI: agentId or null
  UI->>Preload: syncAgents()
  Preload->>IPC: agent-sync-run
  IPC->>Sync: syncAgents()
  Sync->>Account: getAccount()
  Account-->>Sync: normalized apiUrl
  Sync-->>IPC: AgentSyncResult
  IPC-->>UI: agent-sync-updated
Loading

Reviews (1): Last reviewed commit: "Agent Sync" | Re-trigger Greptile

Comment thread src/main/ipc/register.ts
Comment on lines +843 to +845
ipcMain.handle("agent-sync-linked-id", (_event, profile: string) =>
getLinkedAgentId(profile),
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Invalid Profile Rejects Lookup

When the renderer passes an invalid profile slug such as Default or ../x, this handler forwards it into getLinkedAgentId(), which reaches profile-name normalization and throws. The new Sync pane then gets a rejected IPC call instead of null, so a bad or stale profile value leaves the pane without normal linked/unlinked state.

Suggested change
ipcMain.handle("agent-sync-linked-id", (_event, profile: string) =>
getLinkedAgentId(profile),
);
ipcMain.handle("agent-sync-linked-id", (_event, profile: string) => {
try {
return getLinkedAgentId(profile);
} catch {
return null;
}
});

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.

1 participant