mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-19 15:18:03 +00:00
fix(desktop): write project IDEA.md through the remote-aware fs path
writeProjectIdea used the local-only Electron writeTextFile, so on a remote gateway IDEA.md never landed on the backend (where the project folder lives). Route it through writeDesktopFileText (local Electron / POST /api/fs/write-text).
This commit is contained in:
parent
e4cf3a2e9d
commit
9b71221187
1 changed files with 6 additions and 7 deletions
|
|
@ -2,7 +2,7 @@ import { atom } from 'nanostores'
|
|||
|
||||
import { liveSessionProjectId, type SidebarProjectTree } from '@/app/chat/sidebar/projects/workspace-groups'
|
||||
import type { HermesGitBranch } from '@/global'
|
||||
import { desktopDefaultCwd, isDesktopFsRemoteMode, selectDesktopPaths } from '@/lib/desktop-fs'
|
||||
import { desktopDefaultCwd, isDesktopFsRemoteMode, selectDesktopPaths, writeDesktopFileText } from '@/lib/desktop-fs'
|
||||
import { desktopGit } from '@/lib/desktop-git'
|
||||
import { persistentAtom } from '@/lib/persisted'
|
||||
import { activeGateway, ensureActiveGatewayOpen } from '@/store/gateway'
|
||||
|
|
@ -336,20 +336,19 @@ export async function generateProjectIdea(name: string): Promise<string> {
|
|||
}
|
||||
}
|
||||
|
||||
// Write IDEA.md to a project's primary folder (desktop only, best-effort). Local
|
||||
// fs write is hardened in the electron main; a remote backend / missing bridge
|
||||
// just skips it.
|
||||
// Write IDEA.md to a project's primary folder (best-effort). Routes through the
|
||||
// remote-aware fs write, so it lands on the backend for a remote gateway and on
|
||||
// disk locally — the project is created regardless of whether the file lands.
|
||||
async function writeProjectIdea(folder: null | string | undefined, idea: string): Promise<void> {
|
||||
const dir = (folder || '').trim()
|
||||
const body = idea.trim()
|
||||
const write = window.hermesDesktop?.writeTextFile
|
||||
|
||||
if (!dir || !body || !write) {
|
||||
if (!dir || !body) {
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
await write(`${dir.replace(/[/\\]+$/, '')}/IDEA.md`, body.endsWith('\n') ? body : `${body}\n`)
|
||||
await writeDesktopFileText(`${dir.replace(/[/\\]+$/, '')}/IDEA.md`, body.endsWith('\n') ? body : `${body}\n`)
|
||||
} catch {
|
||||
// Best-effort: the project is created regardless of whether IDEA.md lands.
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue