File size: 1,510 Bytes
f726fd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""Single released task-stream entry point."""
from copy import deepcopy
from rescopebench.case_validation import ReleasedCase
from copy import deepcopy as ext_deepcopy
from .spec import DATA, DATA_TOOLS, DATA_TASKS, DATA_PROMPT, DATA_SCHEDULE
from .runtime import World

class Driver(ReleasedCase):
    case_id = 'robot'
    case_version = 'robot-scope-reuse-evolution-v12'

    def __init__(self):
        self.tools = deepcopy(DATA_TOOLS)
        self.tasks = deepcopy(DATA_TASKS)
        self.directory = deepcopy(DATA)
        self.prompt = deepcopy(DATA_PROMPT)
        self.lifecycle_schedule = deepcopy(DATA_SCHEDULE)

    def create_world(self):
        return World()

    def begin(self, world, task):
        boundary = world.activate(task['private_task_id'])
        event_id = boundary.get('activation', {}).get('event_id')
        if event_id != task['event_id']:
            raise ValueError('Robot boundary event differs from the frozen task')
        return {'status': 'success', 'boundary': boundary}

    def call(self, world, name, arguments):
        return world.runtime.dispatch(name, arguments)

    def grade(self, world, task):
        grade = world.runtime.grade()
        grade['completed_artifacts'] = sum((bool(row['workflow_completed']) for row in grade['orders']))
        return grade

    def public_grade(self, grade):
        return {'score': grade['score'], 'public_components': ext_deepcopy(grade['public_components'])}

    def close(self, world):
        world.close()