oh-my-claude-sisyphus 3.2.5 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -2
- package/agents/scientist-high.md +1003 -0
- package/agents/scientist-low.md +232 -0
- package/agents/scientist.md +1180 -0
- package/bridge/__pycache__/gyoshu_bridge.cpython-310.pyc +0 -0
- package/bridge/gyoshu_bridge.py +846 -0
- package/commands/research.md +511 -0
- package/dist/agents/definitions.d.ts +9 -0
- package/dist/agents/definitions.d.ts.map +1 -1
- package/dist/agents/definitions.js +25 -0
- package/dist/agents/definitions.js.map +1 -1
- package/dist/agents/index.d.ts +2 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +2 -1
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/scientist.d.ts +16 -0
- package/dist/agents/scientist.d.ts.map +1 -0
- package/dist/agents/scientist.js +370 -0
- package/dist/agents/scientist.js.map +1 -0
- package/dist/lib/atomic-write.d.ts +29 -0
- package/dist/lib/atomic-write.d.ts.map +1 -0
- package/dist/lib/atomic-write.js +111 -0
- package/dist/lib/atomic-write.js.map +1 -0
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/python-repl/bridge-manager.d.ts +65 -0
- package/dist/tools/python-repl/bridge-manager.d.ts.map +1 -0
- package/dist/tools/python-repl/bridge-manager.js +478 -0
- package/dist/tools/python-repl/bridge-manager.js.map +1 -0
- package/dist/tools/python-repl/index.d.ts +40 -0
- package/dist/tools/python-repl/index.d.ts.map +1 -0
- package/dist/tools/python-repl/index.js +36 -0
- package/dist/tools/python-repl/index.js.map +1 -0
- package/dist/tools/python-repl/paths.d.ts +84 -0
- package/dist/tools/python-repl/paths.d.ts.map +1 -0
- package/dist/tools/python-repl/paths.js +213 -0
- package/dist/tools/python-repl/paths.js.map +1 -0
- package/dist/tools/python-repl/session-lock.d.ts +111 -0
- package/dist/tools/python-repl/session-lock.d.ts.map +1 -0
- package/dist/tools/python-repl/session-lock.js +510 -0
- package/dist/tools/python-repl/session-lock.js.map +1 -0
- package/dist/tools/python-repl/socket-client.d.ts +42 -0
- package/dist/tools/python-repl/socket-client.d.ts.map +1 -0
- package/dist/tools/python-repl/socket-client.js +157 -0
- package/dist/tools/python-repl/socket-client.js.map +1 -0
- package/dist/tools/python-repl/tool.d.ts +100 -0
- package/dist/tools/python-repl/tool.d.ts.map +1 -0
- package/dist/tools/python-repl/tool.js +575 -0
- package/dist/tools/python-repl/tool.js.map +1 -0
- package/dist/tools/python-repl/types.d.ts +95 -0
- package/dist/tools/python-repl/types.d.ts.map +1 -0
- package/dist/tools/python-repl/types.js +2 -0
- package/dist/tools/python-repl/types.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import * as net from 'net';
|
|
2
|
+
import { randomUUID } from 'crypto';
|
|
3
|
+
/**
|
|
4
|
+
* Custom error types for socket communication
|
|
5
|
+
*/
|
|
6
|
+
export class SocketConnectionError extends Error {
|
|
7
|
+
socketPath;
|
|
8
|
+
originalError;
|
|
9
|
+
constructor(message, socketPath, originalError) {
|
|
10
|
+
super(message);
|
|
11
|
+
this.socketPath = socketPath;
|
|
12
|
+
this.originalError = originalError;
|
|
13
|
+
this.name = 'SocketConnectionError';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export class SocketTimeoutError extends Error {
|
|
17
|
+
timeoutMs;
|
|
18
|
+
constructor(message, timeoutMs) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.timeoutMs = timeoutMs;
|
|
21
|
+
this.name = 'SocketTimeoutError';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export class JsonRpcError extends Error {
|
|
25
|
+
code;
|
|
26
|
+
data;
|
|
27
|
+
constructor(message, code, data) {
|
|
28
|
+
super(message);
|
|
29
|
+
this.code = code;
|
|
30
|
+
this.data = data;
|
|
31
|
+
this.name = 'JsonRpcError';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Send a JSON-RPC 2.0 request over Unix socket
|
|
36
|
+
*
|
|
37
|
+
* @param socketPath - Path to the Unix socket
|
|
38
|
+
* @param method - JSON-RPC method name
|
|
39
|
+
* @param params - Optional parameters object
|
|
40
|
+
* @param timeout - Request timeout in milliseconds (default: 60000ms / 1 min)
|
|
41
|
+
* @returns Promise resolving to the result typed as T
|
|
42
|
+
*
|
|
43
|
+
* @throws {SocketConnectionError} If socket connection fails
|
|
44
|
+
* @throws {SocketTimeoutError} If request times out
|
|
45
|
+
* @throws {JsonRpcError} If server returns an error response
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const result = await sendSocketRequest<ExecuteResult>(
|
|
50
|
+
* '/tmp/omc/abc123/bridge.sock',
|
|
51
|
+
* 'execute',
|
|
52
|
+
* { code: 'print("hello")' },
|
|
53
|
+
* 60000
|
|
54
|
+
* );
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export async function sendSocketRequest(socketPath, method, params, timeout = 60000) {
|
|
58
|
+
return new Promise((resolve, reject) => {
|
|
59
|
+
const id = randomUUID();
|
|
60
|
+
const request = {
|
|
61
|
+
jsonrpc: '2.0',
|
|
62
|
+
id,
|
|
63
|
+
method,
|
|
64
|
+
params: params ?? {},
|
|
65
|
+
};
|
|
66
|
+
const requestLine = JSON.stringify(request) + '\n';
|
|
67
|
+
let responseBuffer = '';
|
|
68
|
+
let timedOut = false;
|
|
69
|
+
const MAX_RESPONSE_SIZE = 2 * 1024 * 1024; // 2MB
|
|
70
|
+
// Timeout handler
|
|
71
|
+
const timer = setTimeout(() => {
|
|
72
|
+
timedOut = true;
|
|
73
|
+
socket.destroy();
|
|
74
|
+
reject(new SocketTimeoutError(`Request timeout after ${timeout}ms for method "${method}"`, timeout));
|
|
75
|
+
}, timeout);
|
|
76
|
+
// Cleanup helper
|
|
77
|
+
const cleanup = () => {
|
|
78
|
+
clearTimeout(timer);
|
|
79
|
+
socket.removeAllListeners();
|
|
80
|
+
socket.destroy();
|
|
81
|
+
};
|
|
82
|
+
// Create socket connection
|
|
83
|
+
const socket = net.createConnection({ path: socketPath });
|
|
84
|
+
// Connection established - send request
|
|
85
|
+
socket.on('connect', () => {
|
|
86
|
+
socket.write(requestLine);
|
|
87
|
+
});
|
|
88
|
+
// Receive data
|
|
89
|
+
socket.on('data', (chunk) => {
|
|
90
|
+
responseBuffer += chunk.toString();
|
|
91
|
+
// Prevent memory exhaustion from huge responses
|
|
92
|
+
if (responseBuffer.length > MAX_RESPONSE_SIZE) {
|
|
93
|
+
cleanup();
|
|
94
|
+
reject(new Error(`Response exceeded maximum size of ${MAX_RESPONSE_SIZE} bytes`));
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
// Check for complete newline-delimited response
|
|
98
|
+
const newlineIndex = responseBuffer.indexOf('\n');
|
|
99
|
+
if (newlineIndex !== -1) {
|
|
100
|
+
const jsonLine = responseBuffer.slice(0, newlineIndex);
|
|
101
|
+
cleanup();
|
|
102
|
+
try {
|
|
103
|
+
const response = JSON.parse(jsonLine);
|
|
104
|
+
// Validate JSON-RPC 2.0 response format
|
|
105
|
+
if (response.jsonrpc !== '2.0') {
|
|
106
|
+
reject(new Error(`Invalid JSON-RPC version: expected "2.0", got "${response.jsonrpc}"`));
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
// Validate response ID matches request
|
|
110
|
+
if (response.id !== id) {
|
|
111
|
+
reject(new Error(`Response ID mismatch: expected "${id}", got "${response.id}"`));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
// Handle error response
|
|
115
|
+
if (response.error) {
|
|
116
|
+
reject(new JsonRpcError(response.error.message, response.error.code, response.error.data));
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
// Success - return result
|
|
120
|
+
resolve(response.result);
|
|
121
|
+
}
|
|
122
|
+
catch (e) {
|
|
123
|
+
reject(new Error(`Failed to parse JSON-RPC response: ${e.message}`));
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
// Handle connection errors
|
|
128
|
+
socket.on('error', (err) => {
|
|
129
|
+
if (timedOut) {
|
|
130
|
+
return; // Timeout already handled
|
|
131
|
+
}
|
|
132
|
+
cleanup();
|
|
133
|
+
// Provide specific error messages for common cases
|
|
134
|
+
if (err.code === 'ENOENT') {
|
|
135
|
+
reject(new SocketConnectionError(`Socket does not exist at path: ${socketPath}`, socketPath, err));
|
|
136
|
+
}
|
|
137
|
+
else if (err.code === 'ECONNREFUSED') {
|
|
138
|
+
reject(new SocketConnectionError(`Connection refused - server not listening at: ${socketPath}`, socketPath, err));
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
reject(new SocketConnectionError(`Socket connection error: ${err.message}`, socketPath, err));
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
// Handle connection close
|
|
145
|
+
socket.on('close', () => {
|
|
146
|
+
if (timedOut) {
|
|
147
|
+
return; // Timeout already handled
|
|
148
|
+
}
|
|
149
|
+
// If we haven't received a complete response, this is an error
|
|
150
|
+
if (responseBuffer.indexOf('\n') === -1) {
|
|
151
|
+
cleanup();
|
|
152
|
+
reject(new Error(`Socket closed without sending complete response (method: "${method}")`));
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=socket-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"socket-client.js","sourceRoot":"","sources":["../../../src/tools/python-repl/socket-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAGpC;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IACD;IAAoC;IAAjF,YAAY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,QAAQ,EAAE,CAAC;gBAC1B,MAAM,CAAC,IAAI,qBAAqB,CAC9B,kCAAkC,UAAU,EAAE,EAC9C,UAAU,EACV,GAAG,CACJ,CAAC,CAAC;YACL,CAAC;iBAAM,IAAI,GAAG,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;gBACvC,MAAM,CAAC,IAAI,qBAAqB,CAC9B,iDAAiD,UAAU,EAAE,EAC7D,UAAU,EACV,GAAG,CACJ,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,qBAAqB,CAC9B,4BAA4B,GAAG,CAAC,OAAO,EAAE,EACzC,UAAU,EACV,GAAG,CACJ,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,0BAA0B;QAC1B,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YACtB,IAAI,QAAQ,EAAE,CAAC;gBACb,OAAO,CAAC,0BAA0B;YACpC,CAAC;YAED,+DAA+D;YAC/D,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBACxC,OAAO,EAAE,CAAC;gBACV,MAAM,CAAC,IAAI,KAAK,CACd,6DAA6D,MAAM,IAAI,CACxE,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Python REPL Tool - Main handler implementation
|
|
3
|
+
*
|
|
4
|
+
* Provides a persistent Python REPL environment for code execution.
|
|
5
|
+
* JSON-RPC 2.0 over Unix socket with session locking and timeout escalation.
|
|
6
|
+
*
|
|
7
|
+
* Actions:
|
|
8
|
+
* - execute: Run Python code in the persistent environment
|
|
9
|
+
* - interrupt: Send interrupt to running code with signal escalation
|
|
10
|
+
* - reset: Clear the execution namespace
|
|
11
|
+
* - get_state: Get memory usage and variable list
|
|
12
|
+
*
|
|
13
|
+
* @module python-repl/tool
|
|
14
|
+
*/
|
|
15
|
+
import { z } from 'zod';
|
|
16
|
+
import type { PythonReplInput } from './types.js';
|
|
17
|
+
/**
|
|
18
|
+
* Input schema for the Python REPL tool.
|
|
19
|
+
* Validates and types all input parameters.
|
|
20
|
+
*/
|
|
21
|
+
export declare const pythonReplSchema: z.ZodObject<{
|
|
22
|
+
action: z.ZodEnum<["execute", "interrupt", "reset", "get_state"]>;
|
|
23
|
+
researchSessionID: z.ZodString;
|
|
24
|
+
code: z.ZodOptional<z.ZodString>;
|
|
25
|
+
executionLabel: z.ZodOptional<z.ZodString>;
|
|
26
|
+
executionTimeout: z.ZodDefault<z.ZodNumber>;
|
|
27
|
+
queueTimeout: z.ZodDefault<z.ZodNumber>;
|
|
28
|
+
projectDir: z.ZodOptional<z.ZodString>;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
action: "execute" | "interrupt" | "reset" | "get_state";
|
|
31
|
+
researchSessionID: string;
|
|
32
|
+
executionTimeout: number;
|
|
33
|
+
queueTimeout: number;
|
|
34
|
+
code?: string | undefined;
|
|
35
|
+
executionLabel?: string | undefined;
|
|
36
|
+
projectDir?: string | undefined;
|
|
37
|
+
}, {
|
|
38
|
+
action: "execute" | "interrupt" | "reset" | "get_state";
|
|
39
|
+
researchSessionID: string;
|
|
40
|
+
code?: string | undefined;
|
|
41
|
+
executionLabel?: string | undefined;
|
|
42
|
+
executionTimeout?: number | undefined;
|
|
43
|
+
queueTimeout?: number | undefined;
|
|
44
|
+
projectDir?: string | undefined;
|
|
45
|
+
}>;
|
|
46
|
+
export type PythonReplSchemaInput = z.infer<typeof pythonReplSchema>;
|
|
47
|
+
/**
|
|
48
|
+
* Get and increment the execution counter for a session.
|
|
49
|
+
* Used for tracking execution order in a session.
|
|
50
|
+
*/
|
|
51
|
+
declare function getNextExecutionCount(sessionId: string): number;
|
|
52
|
+
/**
|
|
53
|
+
* Main handler for the Python REPL tool.
|
|
54
|
+
*
|
|
55
|
+
* @param input - Validated input from the tool call
|
|
56
|
+
* @returns Formatted string output for Claude
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* const output = await pythonReplHandler({
|
|
61
|
+
* action: 'execute',
|
|
62
|
+
* researchSessionID: 'my-session',
|
|
63
|
+
* code: 'print("Hello, World!")',
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
export declare function pythonReplHandler(input: PythonReplInput): Promise<string>;
|
|
68
|
+
/**
|
|
69
|
+
* Tool definition for registration with the tool registry.
|
|
70
|
+
*/
|
|
71
|
+
export declare const pythonReplTool: {
|
|
72
|
+
name: string;
|
|
73
|
+
description: string;
|
|
74
|
+
schema: {
|
|
75
|
+
action: z.ZodEnum<["execute", "interrupt", "reset", "get_state"]>;
|
|
76
|
+
researchSessionID: z.ZodString;
|
|
77
|
+
code: z.ZodOptional<z.ZodString>;
|
|
78
|
+
executionLabel: z.ZodOptional<z.ZodString>;
|
|
79
|
+
executionTimeout: z.ZodDefault<z.ZodNumber>;
|
|
80
|
+
queueTimeout: z.ZodDefault<z.ZodNumber>;
|
|
81
|
+
projectDir: z.ZodOptional<z.ZodString>;
|
|
82
|
+
};
|
|
83
|
+
handler: (args: unknown) => Promise<{
|
|
84
|
+
content: {
|
|
85
|
+
type: "text";
|
|
86
|
+
text: string;
|
|
87
|
+
}[];
|
|
88
|
+
}>;
|
|
89
|
+
};
|
|
90
|
+
export { getNextExecutionCount };
|
|
91
|
+
/**
|
|
92
|
+
* Reset the execution counter for a session.
|
|
93
|
+
* Useful for testing or when manually resetting state.
|
|
94
|
+
*/
|
|
95
|
+
export declare function resetExecutionCounter(sessionId: string): void;
|
|
96
|
+
/**
|
|
97
|
+
* Get the current execution count for a session without incrementing.
|
|
98
|
+
*/
|
|
99
|
+
export declare function getExecutionCount(sessionId: string): number;
|
|
100
|
+
//# sourceMappingURL=tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.d.ts","sourceRoot":"","sources":["../../../src/tools/python-repl/tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EACV,eAAe,EAKhB,MAAM,YAAY,CAAC;AAsBpB;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;EA6C3B,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAQrE;;;GAGG;AACH,iBAAS,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAKxD;AA8YD;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAsJ/E;AAMD;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;oBAQH,OAAO;;;;;;CAM9B,CAAC;AAMF,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAE7D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE3D"}
|