File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed
Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 11import type { Task } from "@shared/types" ;
22import { useMutation , useQuery , useQueryClient } from "@tanstack/react-query" ;
33import { useAuthStore } from "../stores/authStore" ;
4+ import { useTaskExecutionStore } from "../stores/taskExecutionStore" ;
45
56export const taskKeys = {
67 all : [ "tasks" ] as const ,
@@ -120,7 +121,15 @@ export function useDuplicateTask() {
120121 if ( ! client ) throw new Error ( "Not authenticated" ) ;
121122 return ( await client . duplicateTask ( taskId ) ) as unknown as Task ;
122123 } ,
123- onSuccess : ( ) => {
124+ onSuccess : ( newTask , originalTaskId ) => {
125+ // Copy working directory from original task to new task
126+ const { getTaskState, setRepoPath } = useTaskExecutionStore . getState ( ) ;
127+ const originalState = getTaskState ( originalTaskId ) ;
128+
129+ if ( originalState . repoPath ) {
130+ setRepoPath ( newTask . id , originalState . repoPath ) ;
131+ }
132+
124133 queryClient . invalidateQueries ( { queryKey : taskKeys . lists ( ) } ) ;
125134 } ,
126135 } ) ;
Original file line number Diff line number Diff line change 1+ import { copyFileSync , mkdirSync } from "node:fs" ;
2+ import { join } from "node:path" ;
13import { defineConfig , type Plugin } from "vite" ;
2- import { copyFileSync , mkdirSync } from "fs" ;
3- import { join } from "path" ;
44
55/**
66 * Custom Vite plugin to fix circular __filename references in bundled ESM packages.
@@ -38,8 +38,14 @@ function copyAgentTemplates(): Plugin {
3838 return {
3939 name : "copy-agent-templates" ,
4040 writeBundle ( ) {
41- const templateSrc = join ( __dirname , "node_modules/@posthog/agent/dist/templates/plan-template.md" ) ;
42- const templateDest = join ( __dirname , ".vite/build/templates/plan-template.md" ) ;
41+ const templateSrc = join (
42+ __dirname ,
43+ "node_modules/@posthog/agent/dist/templates/plan-template.md" ,
44+ ) ;
45+ const templateDest = join (
46+ __dirname ,
47+ ".vite/build/templates/plan-template.md" ,
48+ ) ;
4349
4450 mkdirSync ( join ( __dirname , ".vite/build/templates" ) , { recursive : true } ) ;
4551 copyFileSync ( templateSrc , templateDest ) ;
You can’t perform that action at this time.
0 commit comments