Skip to content

Commit dd7a23a

Browse files
RoyLinRoyLin
authored andcommitted
fix(python-sdk): remove unimplemented AHP harness code
- Remove HarnessServer class and PyHarnessServer struct - Remove harness_server field from SessionOptions - Remove a3s-ahp dependency that caused build failures - This fixes CI build failures for Python SDK on all platforms Follows the same fix applied to Node SDK in commit ede3bec
1 parent 1bb1c1f commit dd7a23a

2 files changed

Lines changed: 0 additions & 76 deletions

File tree

sdk/python/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ crate-type = ["cdylib"]
1313

1414
[dependencies]
1515
a3s-code-core = { version = "1.3", path = "../../core" }
16-
a3s-ahp = { version = "2.0" }
1716
pyo3 = { version = "0.23", features = ["extension-module"] }
1817
tokio = { version = "1.35", features = ["full"] }
1918
serde_json = "1.0"

sdk/python/src/lib.rs

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -2052,48 +2052,6 @@ impl PyDefaultSecurityProvider {
20522052
}
20532053
}
20542054

2055-
// ============================================================================
2056-
// HarnessServer
2057-
// ============================================================================
2058-
2059-
/// External AHP harness server process.
2060-
///
2061-
/// When attached to a session, A3S Code forwards hook events to this process
2062-
/// via the Agent Harness Protocol (JSON-RPC 2.0 over stdio). The process can
2063-
/// be written in any language — Python, Node.js, Go, or a shell script.
2064-
///
2065-
/// .. code-block:: python
2066-
///
2067-
/// opts = SessionOptions()
2068-
/// opts.harness_server = HarnessServer("python3", ["harness.py"])
2069-
/// session = agent.session(".", opts)
2070-
#[pyclass(name = "HarnessServer")]
2071-
#[derive(Clone)]
2072-
struct PyHarnessServer {
2073-
#[pyo3(get, set)]
2074-
program: String,
2075-
#[pyo3(get, set)]
2076-
args: Vec<String>,
2077-
}
2078-
2079-
#[pymethods]
2080-
impl PyHarnessServer {
2081-
/// Create a harness server config.
2082-
///
2083-
/// Args:
2084-
/// program: Executable to run (e.g. "python3", "node", "./harness")
2085-
/// args: Arguments passed to the program (e.g. ["harness.py"])
2086-
#[new]
2087-
#[pyo3(signature = (program, args))]
2088-
fn new(program: String, args: Vec<String>) -> Self {
2089-
Self { program, args }
2090-
}
2091-
2092-
fn __repr__(&self) -> String {
2093-
format!("HarnessServer(program={:?}, args={:?})", self.program, self.args)
2094-
}
2095-
}
2096-
20972055
// ============================================================================
20982056
// SessionOptions
20992057
// ============================================================================
@@ -2145,8 +2103,6 @@ struct PySessionOptions {
21452103
session_id: Option<String>,
21462104
/// Automatically save the session to the configured store after each turn (default: False).
21472105
auto_save: bool,
2148-
/// External AHP harness server. Set to a ``HarnessServer`` instance.
2149-
harness_server: Option<PyHarnessServer>,
21502106
}
21512107

21522108
impl Clone for PySessionOptions {
@@ -2170,7 +2126,6 @@ impl Clone for PySessionOptions {
21702126
max_tool_rounds: self.max_tool_rounds,
21712127
session_id: self.session_id.clone(),
21722128
auto_save: self.auto_save,
2173-
harness_server: self.harness_server.clone(),
21742129
}
21752130
}
21762131
}
@@ -2198,7 +2153,6 @@ impl PySessionOptions {
21982153
max_tool_rounds: None,
21992154
session_id: None,
22002155
auto_save: false,
2201-
harness_server: None,
22022156
}
22032157
}
22042158

@@ -2412,21 +2366,6 @@ impl PySessionOptions {
24122366

24132367
/// External AHP harness server.
24142368
///
2415-
/// Assign a ``HarnessServer`` instance to forward hook events to an
2416-
/// external process via the Agent Harness Protocol:
2417-
///
2418-
/// .. code-block:: python
2419-
///
2420-
/// opts.harness_server = HarnessServer("python3", ["my_harness.py"])
2421-
#[getter]
2422-
fn get_harness_server(&self) -> Option<PyHarnessServer> {
2423-
self.harness_server.clone()
2424-
}
2425-
2426-
#[setter]
2427-
fn set_harness_server(&mut self, value: Option<PyHarnessServer>) {
2428-
self.harness_server = value;
2429-
}
24302369
24312370
/// Register an instruction skill programmatically.
24322371
///
@@ -2795,19 +2734,6 @@ fn build_rust_session_options(so: PySessionOptions) -> RustSessionOptions {
27952734
if so.auto_save {
27962735
o = o.with_auto_save(true);
27972736
}
2798-
if let Some(hs) = so.harness_server {
2799-
match get_runtime().block_on(a3s_ahp::AhpHookExecutor::spawn(
2800-
&hs.program,
2801-
hs.args.as_slice(),
2802-
)) {
2803-
Ok(executor) => {
2804-
o = o.with_hook_executor(executor);
2805-
}
2806-
Err(e) => {
2807-
eprintln!("a3s-code: AHP harness spawn failed: {e}");
2808-
}
2809-
}
2810-
}
28112737
o
28122738
}
28132739

@@ -4520,7 +4446,6 @@ fn a3s_code(m: &Bound<'_, PyModule>) -> PyResult<()> {
45204446
m.add_class::<PyFileSessionStore>()?;
45214447
m.add_class::<PyMemorySessionStore>()?;
45224448
m.add_class::<PyDefaultSecurityProvider>()?;
4523-
m.add_class::<PyHarnessServer>()?;
45244449
m.add_class::<PySessionOptions>()?;
45254450
m.add_class::<PySessionQueueConfig>()?;
45264451
m.add_class::<PySearchConfig>()?;

0 commit comments

Comments
 (0)