Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(project-setup): core-shared run wrapper + narrowed wire, refusal tests

enes26a6846b1615
diff --git a/src/core/project-setup-handlers.ts b/src/core/project-setup-handlers.ts
index 76031e7ac..993e6df16 100644
--- a/src/core/project-setup-handlers.ts
+++ b/src/core/project-setup-handlers.ts
@@ -1,7 +1,9 @@
import { IPC } from '../shared/ipc'
import type { ProjectSetupConsentAnswer, ProjectSetupKind, ProjectSetupRunResult } from '../shared/project-settings'
+import type { WorktreeListResult } from '../shared/worktree'
import type { CorePlatform } from './platform'
import type { ProjectSetupTarget } from './project-setup-service'
+import { resolveProjectSetupTarget, type ProjectSetupTargetInfo } from './project-setup-runner-local'
/**
* RPC surface for the setup/archive runner, registered once for every shell (Electron main + Server
@@ -12,9 +14,14 @@ import type { ProjectSetupTarget } from './project-setup-service'
* `projectSetupEvent` push is registered unconditionally. The channels exist so the renderer's
* lifecycle (and a later ref-counted gate) needs no protocol change.
*
- * Everything crossing this seam is renderer/client input, so the target is shape-checked here
- * rather than trusted — the service's own gate protects the dangerous half, but a malformed target
- * must answer a result, not throw an IPC error.
+ * The wire's `run` carries ONLY `(projectId, kind, worktreePath?)` — the same three things
+ * `ProjectSetupApi.run` exposes to the renderer. `rootPath`/`projectName`/`ssh` are never on the
+ * wire at all: this registrar derives them itself, from `deps.projectTargetInfo` (this shell's own
+ * workspace index, never the renderer) by `projectId`, and independently re-validates
+ * `worktreePath` against `deps.worktreeList`'s answer for that project (`resolveProjectSetupTarget`,
+ * project-setup-runner-local.ts) — a hostile/compromised renderer cannot name an arbitrary path or
+ * forge an `ssh` target this way. `cancel`/`consentSubmit` carry no path-shaped data and are
+ * shape-checked in place, same as before.
*/
export interface ProjectSetupHandlerService {
run(target: ProjectSetupTarget, kind: ProjectSetupKind): Promise<ProjectSetupRunResult>
@@ -22,56 +29,38 @@ export interface ProjectSetupHandlerService {
submitConsent(requestId: string, answer: ProjectSetupConsentAnswer): void
}
-const isKind = (v: unknown): v is ProjectSetupKind => v === 'setup' || v === 'archive'
-
-function sanitizeTarget(v: unknown): ProjectSetupTarget | null {
- if (typeof v !== 'object' || v === null) return null
- const t = v as Record<string, unknown>
- if (typeof t.projectId !== 'string' || !t.projectId) return null
- if (typeof t.projectName !== 'string') return null
- if (typeof t.rootPath !== 'string' || !t.rootPath) return null
- const out: ProjectSetupTarget = {
- projectId: t.projectId,
- projectName: t.projectName,
- rootPath: t.rootPath
- }
- if (typeof t.worktreePath === 'string' && t.worktreePath) out.worktreePath = t.worktreePath
- if (t.ssh !== undefined) {
- // A malformed `ssh` is REJECTED, never stripped: dropping the field would silently downgrade a
- // remote run into a local one, executing the remote project's script on this machine — and
- // against the wrong (local) trust key.
- const ssh = typeof t.ssh === 'object' && t.ssh !== null ? (t.ssh as Record<string, unknown>) : null
- if (!ssh) return null
- const server =
- typeof ssh.server === 'object' && ssh.server !== null ? (ssh.server as Record<string, unknown>) : null
- if (!server) return null
- if (typeof server.host !== 'string' || !server.host) return null
- if (typeof server.user !== 'string' || !server.user) return null
- if (server.port !== undefined && typeof server.port !== 'number') return null
- if (server.identityFile !== undefined && typeof server.identityFile !== 'string') return null
- if (typeof ssh.remoteCwd !== 'string' || !ssh.remoteCwd) return null
- out.ssh = {
- server: {
- host: server.host,
- user: server.user,
- ...(typeof server.port === 'number' ? { port: server.port } : {}),
- ...(typeof server.identityFile === 'string' ? { identityFile: server.identityFile } : {})
- },
- remoteCwd: ssh.remoteCwd
- }
- }
- return out
+/** What `registerProjectSetupHandlers` needs from its shell to resolve a trusted target — the
+ * Task 1 review finding, closed centrally here so main/server share the ONE implementation instead
+ * of each re-deriving it. */
+export interface ProjectSetupHandlerDeps {
+ /** This shell's own workspace index lookup (e.g. `WorkspaceStore.projectTargetInfo`). */
+ projectTargetInfo(projectId: string): ProjectSetupTargetInfo | null
+ /** `git worktree list` for a repo root (e.g. `GitService#worktreeList` bound to the caller). */
+ worktreeList(repoPath: string): Promise<WorktreeListResult>
}
+const isKind = (v: unknown): v is ProjectSetupKind => v === 'setup' || v === 'archive'
+
export function registerProjectSetupHandlers(
platform: CorePlatform,
- service: ProjectSetupHandlerService
+ service: ProjectSetupHandlerService,
+ deps: ProjectSetupHandlerDeps
): void {
- platform.handle(IPC.projectSetupRun, async (target: unknown, kind: unknown): Promise<ProjectSetupRunResult> => {
- const t = sanitizeTarget(target)
- if (!t || !isKind(kind)) return { status: 'skipped', reason: 'unavailable' }
- return service.run(t, kind)
- })
+ platform.handle(
+ IPC.projectSetupRun,
+ async (projectId: unknown, kind: unknown, worktreePath?: unknown): Promise<ProjectSetupRunResult> => {
+ if (typeof projectId !== 'string' || !projectId || !isKind(kind)) {
+ return { status: 'skipped', reason: 'unavailable' }
+ }
+ if (worktreePath !== undefined && typeof worktreePath !== 'string') {
+ return { status: 'skipped', reason: 'unavailable' }
+ }
+ const info = deps.projectTargetInfo(projectId)
+ const target = await resolveProjectSetupTarget(projectId, worktreePath, info, deps.worktreeList)
+ if (!target) return { status: 'skipped', reason: 'unavailable' }
+ return service.run(target, kind)
+ }
+ )
platform.handle(IPC.projectSetupCancel, (runKey: unknown) =>
typeof runKey === 'string' ? service.cancel(runKey) : false)
platform.on(IPC.projectSetupConsentSubmit, (requestId: unknown, answer: unknown) => {
diff --git a/src/core/project-setup-service.test.ts b/src/core/project-setup-service.test.ts
index c5d000955..156aead44 100644
--- a/src/core/project-setup-service.test.ts
+++ b/src/core/project-setup-service.test.ts
@@ -21,7 +21,8 @@ import {
type ProjectSetupRunner,
type ProjectSetupTarget
} from './project-setup-service'
-import { registerProjectSetupHandlers } from './project-setup-handlers'
+import { registerProjectSetupHandlers, type ProjectSetupHandlerDeps } from './project-setup-handlers'
+import type { WorktreeListResult } from '../shared/worktree'
let userData: string
let plat: FakePlatform
@@ -455,7 +456,19 @@ describe('ProjectSetupService — single-flight, cancel and absent scripts', ()
})
describe('registerProjectSetupHandlers', () => {
- const stub = () => {
+ const okWorktrees = (paths: string[] = []): ProjectSetupHandlerDeps['worktreeList'] =>
+ async (): Promise<WorktreeListResult> => ({
+ ok: true,
+ entries: paths.map((p) => ({ path: p, branch: null, head: null, isBare: false }))
+ })
+
+ const defaultDeps = (over: Partial<ProjectSetupHandlerDeps> = {}): ProjectSetupHandlerDeps => ({
+ projectTargetInfo: (projectId) => (projectId === 'p1' ? { cwd: '/proj/app', name: 'App' } : null),
+ worktreeList: okWorktrees(),
+ ...over
+ })
+
+ const stub = (deps: Partial<ProjectSetupHandlerDeps> = {}) => {
const runs: Array<[ProjectSetupTarget, string]> = []
const cancels: string[] = []
const consents: Array<[string, string]> = []
@@ -472,7 +485,7 @@ describe('registerProjectSetupHandlers', () => {
consents.push([requestId, answer])
}
}
- registerProjectSetupHandlers(plat, service)
+ registerProjectSetupHandlers(plat, service, defaultDeps(deps))
return { runs, cancels, consents }
}
@@ -492,58 +505,73 @@ describe('registerProjectSetupHandlers', () => {
expect(() => plat.listeners[IPC.projectSetupUnsubscribe]('p1')).not.toThrow()
})
- it('passes a well-formed target through and answers a malformed one instead of throwing', async () => {
+ it('derives rootPath/projectName from projectTargetInfo — the wire carries only projectId/kind', async () => {
const { runs } = stub()
const call = plat.handlers[IPC.projectSetupRun]
+ expect(await call('p1', 'archive')).toMatchObject({ status: 'started' })
+ expect(runs).toHaveLength(1)
+ expect(runs[0]).toEqual([{ projectId: 'p1', projectName: 'App', rootPath: '/proj/app' }, 'archive'])
+ })
+
+ it('derives an ssh target from projectTargetInfo alone — nothing ssh-shaped is on the wire', async () => {
const ssh = { server: { host: 'h', user: 'u', port: 2222 }, remoteCwd: '/srv/app' }
- expect(await call({ ...target(), worktreePath: '/wt', ssh, bogus: 'x' }, 'archive')).toMatchObject({
- status: 'started'
- })
- expect(runs[0][1]).toBe('archive')
- expect(runs[0][0]).toEqual({ ...target(), worktreePath: '/wt', ssh })
+ const { runs } = stub({ projectTargetInfo: (id) => (id === 'p1' ? { name: 'App', ssh } : null) })
+ const call = plat.handlers[IPC.projectSetupRun]
+ expect(await call('p1', 'setup')).toMatchObject({ status: 'started' })
+ expect(runs[0][0]).toEqual({ projectId: 'p1', projectName: 'App', rootPath: '/srv/app', ssh })
+ })
- for (const bad of [null, {}, { projectId: 'p', projectName: 'n' }, 'nope']) {
- expect(await call(bad, 'setup')).toEqual({ status: 'skipped', reason: 'unavailable' })
+ it('answers unavailable for a malformed call instead of throwing, and never calls service.run', async () => {
+ const { runs } = stub()
+ const call = plat.handlers[IPC.projectSetupRun]
+ for (const args of [[null, 'setup'], [7, 'setup'], ['', 'setup'], ['p1', 'launch'], ['p1', null]] as const) {
+ expect(await call(...args)).toEqual({ status: 'skipped', reason: 'unavailable' })
}
- expect(await call(target(), 'launch')).toEqual({ status: 'skipped', reason: 'unavailable' })
- expect(runs).toHaveLength(1)
+ // A non-string worktreePath (a hostile/buggy caller) is refused outright, not coerced.
+ expect(await call('p1', 'setup', 42)).toEqual({ status: 'skipped', reason: 'unavailable' })
+ expect(runs).toHaveLength(0)
})
- it('rejects a malformed ssh target instead of stripping it down to a LOCAL run', async () => {
+ it('refuses an unknown projectId — service.run is never reached', async () => {
const { runs } = stub()
const call = plat.handlers[IPC.projectSetupRun]
- const bad = [
- 'garbage',
- 7,
- { server: { host: 'h' } },
- { server: { host: 'h', user: 'u' } }, // no remoteCwd
- { server: { host: 'h', user: 'u', port: '22' }, remoteCwd: '/srv' },
- { server: { host: 'h', user: 'u', identityFile: 3 }, remoteCwd: '/srv' },
- { server: 'h@u', remoteCwd: '/srv' }
- ]
- for (const ssh of bad) {
- expect(await call({ ...target(), ssh }, 'setup')).toEqual({ status: 'skipped', reason: 'unavailable' })
- }
+ expect(await call('missing', 'setup')).toEqual({ status: 'skipped', reason: 'unavailable' })
expect(runs).toHaveLength(0)
})
- it('end to end: a malformed ssh target never reaches the local runner', async () => {
+ it('refuses a relative worktreePath — service.run is never reached', async () => {
+ const { runs } = stub()
+ const call = plat.handlers[IPC.projectSetupRun]
+ expect(await call('p1', 'setup', 'relative/path')).toEqual({ status: 'skipped', reason: 'unavailable' })
+ expect(runs).toHaveLength(0)
+ })
+
+ it('refuses a hostile absolute worktreePath that is not one of the project\'s actual git worktrees', async () => {
+ const { runs } = stub({ worktreeList: okWorktrees(['/proj/app.worktrees/real-branch']) })
+ const call = plat.handlers[IPC.projectSetupRun]
+ expect(await call('p1', 'setup', '/etc/passwd')).toEqual({ status: 'skipped', reason: 'unavailable' })
+ expect(runs).toHaveLength(0)
+ })
+
+ it('accepts a worktreePath that matches one of the project\'s actual git worktrees', async () => {
+ const wt = '/proj/app.worktrees/real-branch'
+ const { runs } = stub({ worktreeList: okWorktrees([wt]) })
+ const call = plat.handlers[IPC.projectSetupRun]
+ expect(await call('p1', 'setup', wt)).toMatchObject({ status: 'started' })
+ expect(runs[0][0]).toEqual({ projectId: 'p1', projectName: 'App', rootPath: '/proj/app', worktreePath: wt })
+ })
+
+ it('end to end: an unknown projectId never reaches the local runner', async () => {
const { calls, runner } = recorder()
const service = new ProjectSetupService({
trust: new ProjectTrustStore(),
readSettings: async () => snapshot(null, { setup: { setupScript: 'echo hi' } }),
runLocal: runner
})
- registerProjectSetupHandlers(plat, service)
+ registerProjectSetupHandlers(plat, service, defaultDeps())
const call = plat.handlers[IPC.projectSetupRun]
- expect(await call({ ...target(), ssh: 'garbage' }, 'setup')).toEqual({
- status: 'skipped',
- reason: 'unavailable'
- })
- expect(await call({ ...target(), ssh: { server: { host: 'h' } } }, 'setup')).toEqual({
- status: 'skipped',
- reason: 'unavailable'
- })
+ expect(await call('missing', 'setup')).toEqual({ status: 'skipped', reason: 'unavailable' })
+ expect(await call('p1', 'setup', '/etc/passwd')).toEqual({ status: 'skipped', reason: 'unavailable' })
expect(calls).toHaveLength(0)
})
diff --git a/src/main/index.ts b/src/main/index.ts
index 0526e4b2d..dc669506a 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -65,8 +65,8 @@ import { SshStore } from './ssh-store'
import { GitService } from '../core/git-service'
import { ProjectTrustStore } from '../core/project-trust-store'
import { ProjectSetupService } from '../core/project-setup-service'
-import { registerProjectSetupHandlers, type ProjectSetupHandlerService } from '../core/project-setup-handlers'
-import { makeLocalSetupRunner, resolveProjectSetupTarget } from '../core/project-setup-runner-local'
+import { registerProjectSetupHandlers } from '../core/project-setup-handlers'
+import { makeLocalSetupRunner } from '../core/project-setup-runner-local'
import { registerGitHubIntegration } from '../core/github/integration'
import { runGitHubCliCommand } from '../core/github/credentials'
import {
@@ -346,7 +346,12 @@ const gitService = new GitService()
// Project setup/archive runner (SDD: 2026-08-19-project-settings-trust). The trust store is keyed
// by LOCATION, never project id (hostile-project-json), so one instance covers every project.
-// `readSettings` reuses WorkspaceStore's own resolution instead of re-reading disk.
+// `readSettings` reuses WorkspaceStore's own resolution instead of re-reading disk. `ProjectSetupService`
+// already matches `ProjectSetupHandlerService`'s shape, so it is passed straight through — the
+// TRUST boundary (deriving rootPath/ssh/projectName from THIS machine's own index by projectId,
+// never the renderer, and re-validating `worktreePath` against the project's actual git worktrees)
+// lives centrally in `registerProjectSetupHandlers` itself (project-setup-handlers.ts), shared with
+// the Server Edition below instead of re-implemented per shell.
const projectTrustStore = new ProjectTrustStore()
const projectSetupService = new ProjectSetupService({
trust: projectTrustStore,
@@ -355,26 +360,10 @@ const projectSetupService = new ProjectSetupService({
// runSsh: a later task's manual-run leg. Until wired, an ssh target's run answers
// `{status:'skipped', reason:'unavailable'}` — same as any other missing runner.
})
-// `registerProjectSetupHandlers` (project-setup-handlers.ts) shape-checks its wire `target` but
-// otherwise trusts whatever it is given — a deliberate low-level seam (Task 1). The TRUST boundary
-// lives here instead: `target.rootPath`/`projectName`/`ssh` are the wire's own placeholders (see
-// preload's `projectSetup.run`) and are IGNORED — rootPath/ssh/projectName are re-derived from THIS
-// machine's own workspace index by `target.projectId`, and `worktreePath` is independently
-// re-validated against the project's actual git worktrees (`resolveProjectSetupTarget`). Nothing
-// path-shaped that crosses the wire is trusted as-is (Task 1 review finding, carried to this task).
-const projectSetupHandlerService: ProjectSetupHandlerService = {
- run: async (target, kind) => {
- const info = workspaceStore.projectTargetInfo(target.projectId)
- const resolved = await resolveProjectSetupTarget(target.projectId, target.worktreePath, info, (repoPath) =>
- gitService.worktreeList(repoPath)
- )
- if (!resolved) return { status: 'skipped', reason: 'unavailable' }
- return projectSetupService.run(resolved, kind)
- },
- cancel: (runKey) => projectSetupService.cancel(runKey),
- submitConsent: (requestId, answer) => projectSetupService.submitConsent(requestId, answer)
-}
-registerProjectSetupHandlers(corePlatform, projectSetupHandlerService)
+registerProjectSetupHandlers(corePlatform, projectSetupService, {
+ projectTargetInfo: (projectId) => workspaceStore.projectTargetInfo(projectId),
+ worktreeList: (repoPath) => gitService.worktreeList(repoPath)
+})
// Markers delimiting the `projects.list` relay blob. The iOS client splits on these exact
// strings to recover [workspace.json | newline-joined tmux session names | agent-status.json],
diff --git a/src/preload/index.ts b/src/preload/index.ts
index d2f2a7a80..3fab0a530 100644
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@ -155,17 +155,11 @@ const api: NodeTerminalApi = {
ipcRenderer.invoke(IPC.projectSettingsUpdateLocal, projectId, local)
},
projectSetup: {
- // The wire's `target` first argument is `project-setup-handlers.ts`'s `sanitizeTarget` shape
- // (Task 1) — `projectName`/`rootPath` here are UNUSED PLACEHOLDERS satisfying that shape only;
- // main re-derives the real rootPath/projectName/ssh from its own workspace index by projectId
- // and never trusts what crosses this wire (Task 1 review finding — see main/index.ts's
- // `projectSetupHandlerService`). Only `projectId`/`worktreePath` cross meaningfully.
+ // Wire carries exactly `(projectId, kind, worktreePath?)` — no rootPath/projectName/ssh: main
+ // derives those itself from its own workspace index by projectId and never trusts what crosses
+ // this wire (project-setup-handlers.ts's `registerProjectSetupHandlers`, Task 1 review finding).
run: (projectId, kind, worktreePath) =>
- ipcRenderer.invoke(
- IPC.projectSetupRun,
- { projectId, projectName: '', rootPath: '.', ...(worktreePath ? { worktreePath } : {}) },
- kind
- ),
+ ipcRenderer.invoke(IPC.projectSetupRun, projectId, kind, worktreePath),
cancel: (runKey: string) => ipcRenderer.invoke(IPC.projectSetupCancel, runKey),
consent: async (requestId, answer) => {
ipcRenderer.send(IPC.projectSetupConsentSubmit, requestId, answer)
diff --git a/src/renderer/bridge/ws-bridge.ts b/src/renderer/bridge/ws-bridge.ts
index be5233dcd..530229b65 100644
--- a/src/renderer/bridge/ws-bridge.ts
+++ b/src/renderer/bridge/ws-bridge.ts
@@ -305,15 +305,13 @@ export function buildRealApi(
}
// REAL: registerProjectSetupHandlers (core) is wired on the same construction-order point as
- // src/main/index.ts — see the "target.rootPath/projectName/ssh are placeholders" comment there.
- // `run`'s wire shape mirrors the preload's exactly, for the same reason.
+ // src/main/index.ts. Wire carries exactly `(projectId, kind, worktreePath?)` — no rootPath/
+ // projectName/ssh; the server derives those itself from its own workspace index, same as main.
const projectSetup: NodeTerminalApi['projectSetup'] = {
run: (projectId, kind, worktreePath) =>
- client.request(
- IPC.projectSetupRun,
- { projectId, projectName: '', rootPath: '.', ...(worktreePath ? { worktreePath } : {}) },
- kind
- ) as ReturnType<NodeTerminalApi['projectSetup']['run']>,
+ client.request(IPC.projectSetupRun, projectId, kind, worktreePath) as ReturnType<
+ NodeTerminalApi['projectSetup']['run']
+ >,
cancel: (runKey) => client.request(IPC.projectSetupCancel, runKey) as Promise<boolean>,
consent: async (requestId, answer) => {
client.cast(IPC.projectSetupConsentSubmit, requestId, answer)
diff --git a/src/server/index.ts b/src/server/index.ts
index 59e0ea9b4..a2dd2da11 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -33,8 +33,8 @@ import { DownloadTickets } from '../core/download-tickets'
import { registerBoardLogHandlers, type BoardLogRoute } from '../core/board-log-handlers'
import { ProjectTrustStore } from '../core/project-trust-store'
import { ProjectSetupService } from '../core/project-setup-service'
-import { registerProjectSetupHandlers, type ProjectSetupHandlerService } from '../core/project-setup-handlers'
-import { makeLocalSetupRunner, resolveProjectSetupTarget } from '../core/project-setup-runner-local'
+import { registerProjectSetupHandlers } from '../core/project-setup-handlers'
+import { makeLocalSetupRunner } from '../core/project-setup-runner-local'
import { LogBuffer } from '../core/log-buffer'
import { installLogSink } from '../core/log-sink'
import { registerLogHandlers } from '../core/log-handlers'
@@ -270,33 +270,23 @@ export async function startServer(
downloadTickets,
localProjectCwd: (projectId: string) => workspaceStore.localCwdForProject(projectId)
})
- // Project setup/archive runner — same construction + trust boundary as src/main/index.ts. No ssh
- // leg here at all (the Server Edition has no SSH projects, same reason board-log's router below
- // never resolves one): `resolveProjectSetupTarget` degrades an ssh-shaped index entry to
- // `unavailable` on its own since `info.ssh` is never populated on this shell.
+ // Project setup/archive runner — same construction as src/main/index.ts, and the SAME
+ // `registerProjectSetupHandlers` trust boundary (project-setup-handlers.ts): it derives rootPath/
+ // ssh/projectName from THIS process's own workspace index by projectId, never the renderer, and
+ // re-validates `worktreePath` against the project's actual git worktrees. No ssh leg here at all
+ // (the Server Edition has no SSH projects, same reason board-log's router below never resolves
+ // one) — `projectTargetInfo` never populates `ssh` on this shell, so an ssh-shaped target simply
+ // never arises.
const projectTrustStore = new ProjectTrustStore()
const projectSetupService = new ProjectSetupService({
trust: projectTrustStore,
readSettings: (projectId) => workspaceStore.readProjectSettings(projectId),
runLocal: makeLocalSetupRunner()
})
- // See src/main/index.ts's matching comment: `target.rootPath`/`projectName`/`ssh` on the wire are
- // placeholders (preload/ws-bridge never send real ones) and are IGNORED here — rootPath/ssh/
- // projectName are re-derived from this process's own workspace index by `target.projectId`, and
- // `worktreePath` is independently re-validated against the project's actual git worktrees.
- const projectSetupHandlerService: ProjectSetupHandlerService = {
- run: async (target, kind) => {
- const info = workspaceStore.projectTargetInfo(target.projectId)
- const resolved = await resolveProjectSetupTarget(target.projectId, target.worktreePath, info, (repoPath) =>
- gitService.worktreeList(repoPath)
- )
- if (!resolved) return { status: 'skipped', reason: 'unavailable' }
- return projectSetupService.run(resolved, kind)
- },
- cancel: (runKey) => projectSetupService.cancel(runKey),
- submitConsent: (requestId, answer) => projectSetupService.submitConsent(requestId, answer)
- }
- registerProjectSetupHandlers(platform, projectSetupHandlerService)
+ registerProjectSetupHandlers(platform, projectSetupService, {
+ projectTargetInfo: (projectId) => workspaceStore.projectTargetInfo(projectId),
+ worktreeList: (repoPath) => gitService.worktreeList(repoPath)
+ })
const github = registerGitHubIntegration({
platform,
diff --git a/src/shared/ipc.ts b/src/shared/ipc.ts
index 634a03884..733675210 100644
--- a/src/shared/ipc.ts
+++ b/src/shared/ipc.ts
@@ -241,8 +241,10 @@ export const IPC = {
projectSettingsRead: 'project-settings:read',
projectSettingsWriteShared: 'project-settings:write-shared',
projectSettingsUpdateLocal: 'project-settings:update-local',
- /** Run a project's setup/archive script. Answers a ProjectSetupRunResult — `started` only means
- * the run was admitted (gated + single-flight), not that it finished; progress arrives on
+ /** Run a project's setup/archive script. Args: (projectId, kind, worktreePath?) — NO rootPath/
+ * projectName/ssh: the handler derives those itself from its own workspace index by projectId,
+ * never the caller (project-setup-handlers.ts). Answers a ProjectSetupRunResult — `started` only
+ * means the run was admitted (gated + single-flight), not that it finished; progress arrives on
* projectSetupEvent. */
projectSetupRun: 'project-setup:run',
projectSetupCancel: 'project-setup:cancel',