MCPcopy Create free account
hub / github.com/commandoperator/cmdop-sdk / MachinesResource

Class MachinesResource

python/src/cmdop/resources/machines.py:32–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30 attachments = list(attachment_ids)
31 if not prompt and not attachments:
32 raise ValueError("prompt or at least one attachment_id is required")
33 options = pb.AskOptions(attachment_ids=attachments)
34 for name, value in (
35 ("pin", pin),
36 ("session", session),
37 ("engine", engine),
38 ("working_dir", working_dir),
39 ("project_root_id", project_root_id),
40 ("model", model),
41 ):
42 if value is not None:
43 setattr(options, name, value)
44 return self._t.call_stream(
45 pb.Envelope(
46 ask_machine_req=pb.AskMachineRequest(
47 machine_id=str(machine_id), prompt=prompt, options=options
48 )
49 )
50 )
51
52 async def messages(
53 self,
54 machine_id: str,
55 *,
56 session: str | None = None,
57 limit: int | None = None,
58 ) -> pb.MachineMessageList:
59 if limit is not None and not 1 <= limit <= 500:
60 raise ValueError("limit must be between 1 and 500")
61 request = pb.ListMachineMessagesRequest(machine_id=str(machine_id))
62 if session is not None:
63 request.session = session
64 if limit is not None:
65 request.limit = limit
66 response = await self._unary(pb.Envelope(list_machine_messages_req=request))
67 return response.machine_message_list

Callers 1

machinesMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected