Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion apps/web/src/components/gastown/MayorChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,22 @@ export function MayorChat({ townId }: MayorChatProps) {
// Eagerly ensure mayor agent + container on mount
const ensureMayor = useMutation(
trpc.gastown.ensureMayor.mutationOptions({
onSuccess: () => {
onSuccess: data => {
queryClient.setQueryData(
trpc.gastown.getMayorStatus.queryKey({ townId }),
(old: { configured?: boolean; townId?: string; session?: { agentId?: string; sessionId?: string; status?: string; lastActivityAt?: string } } | undefined) => ({
...(old ?? {}),
configured: true,
townId,
session: {
...(old?.session ?? {}),
agentId: data.agentId,
sessionId: data.agentId,
status: data.sessionStatus,
lastActivityAt: old?.session?.lastActivityAt ?? new Date().toISOString(),
},
})
);
void queryClient.invalidateQueries({
queryKey: trpc.gastown.getMayorStatus.queryKey(),
});
Expand Down
17 changes: 16 additions & 1 deletion apps/web/src/components/gastown/TerminalBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,22 @@ function MayorTerminalPane({ townId, collapsed }: { townId: string; collapsed: b

const ensureMayor = useMutation(
trpc.gastown.ensureMayor.mutationOptions({
onSuccess: () => {
onSuccess: data => {
queryClient.setQueryData(
trpc.gastown.getMayorStatus.queryKey({ townId }),
(old: { configured?: boolean; townId?: string; session?: { agentId?: string; sessionId?: string; status?: string; lastActivityAt?: string } } | undefined) => ({
...(old ?? {}),
configured: true,
townId,
session: {
...(old?.session ?? {}),
agentId: data.agentId,
sessionId: data.agentId,
status: data.sessionStatus,
lastActivityAt: old?.session?.lastActivityAt ?? new Date().toISOString(),
},
})
);
void queryClient.invalidateQueries({
queryKey: trpc.gastown.getMayorStatus.queryKey(),
});
Expand Down
4 changes: 4 additions & 0 deletions services/gastown/container/src/agent-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,10 @@ async function verifyGitCredentials(
* kilo serve requires a git repo in the working directory, so we init
* a bare local repo with an empty initial commit.
*/
export function mayorWorkdirForTown(townId: string): string {
return `/workspace/rigs/mayor-${townId}/mayor-workspace`;
}

async function createLightweightWorkspace(label: string, rigId: string): Promise<string> {
const { mkdir: mkdirAsync } = await import('node:fs/promises');
const { existsSync } = await import('node:fs');
Expand Down
Loading