MCPcopy Create free account
hub / github.com/Athena-AI-Lab/athena-core / load

Method load

src/plugins/shell/init.ts:10–223  ·  view source on GitHub ↗
(athena: Athena)

Source from the content-addressed store, hash-verified

8 processes: { [key: number]: ShellProcess } = {};
9
10 async load(athena: Athena) {
11 athena.registerEvent({
12 name: "shell/stdout",
13 desc: "Triggered when a shell command outputs to stdout",
14 args: {
15 pid: {
16 type: "number",
17 desc: "Process ID",
18 required: true,
19 },
20 stdout: {
21 type: "string",
22 desc: "Standard output of the command",
23 required: true,
24 },
25 },
26 explain_args: (args: Dict<any>) => ({
27 summary: `Process ${args.pid} output to stdout.`,
28 details: args.stdout,
29 }),
30 });
31 athena.registerEvent({
32 name: "shell/terminated",
33 desc: "Triggered when a shell command terminates",
34 args: {
35 pid: {
36 type: "number",
37 desc: "Process ID",
38 required: true,
39 },
40 code: {
41 type: "number",
42 desc: "Exit code of the process",
43 required: true,
44 },
45 stdout: {
46 type: "string",
47 desc: "The remaining output of the process",
48 required: true,
49 },
50 },
51 explain_args: (args: Dict<any>) => ({
52 summary: `Process ${args.pid} terminated.`,
53 details: args.stdout,
54 }),
55 });
56 athena.registerTool(
57 {
58 name: "shell/exec",
59 desc: "Executes a shell command. Whenever you need to run a shell command, or the user's request requires running a shell command, use this tool. When this tool returns, the command is still running. You need to wait for it to output or terminate.",
60 args: {
61 command: {
62 type: "string",
63 desc: "Shell command",
64 required: true,
65 },
66 },
67 retvals: {

Callers

nothing calls this directly

Calls 5

writeMethod · 0.95
killMethod · 0.95
registerEventMethod · 0.80
registerToolMethod · 0.80
emitEventMethod · 0.80

Tested by

no test coverage detected