feat(coding-agent): implemented shared Python gateway for efficient kernel reuse

- Added Python shared gateway setting for resource-efficient kernel reuse across sessions.
- Enhanced Python tool with session-scoped kernel isolation and workdir-aware session IDs.
- Added Python tool cancellation support with timeout handling and proper cleanup.
- Expanded Python prelude with enhanced file operations, git utilities, and improved output handling.
- Fixed AI provider message transformation for proper tool call handling and error recovery.
This commit is contained in:
can1357
2026-01-18 21:07:02 +01:00
parent b40d2db72e
commit aac8187e05
28 changed files with 1263 additions and 350 deletions
@@ -20,6 +20,7 @@ function createSettings(overrides?: Partial<ToolSession["settings"]>): ToolSessi
getBashInterceptorRules: () => [],
getPythonToolMode: () => "ipy-only",
getPythonKernelMode: () => "session",
getPythonSharedGateway: () => true,
...overrides,
};
}
@@ -81,7 +82,10 @@ describe("python tool settings", () => {
expect(executeSpy).toHaveBeenCalledWith(
"print(1)",
expect.objectContaining({ kernelMode: "per-call", sessionId: "session.json" }),
expect.objectContaining({
kernelMode: "per-call",
sessionId: `session:session.json:workdir:${testDir}`,
}),
);
});
});