Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/bub/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ version = "0.0.1"
description = "Bub-driven PowerContext session replay harness."
requires-python = ">=3.12,<4.0"
dependencies = [
"bub==0.5.1",
"bub[app]==0.6.1",
"harbor>=0.16,<0.17",
"loguru>=0.7,<1",
"marko>=2.2,<3",
Expand Down
8 changes: 4 additions & 4 deletions e2e/bub/src/powercontext_e2e/harbor_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
BUB_VERSION = version("bub")
POWERCONTEXT_VERSION = version("powercontext")
# Change ACP_SDK_REQUIREMENT together with this version: it repeats the server's own pin of the ACP SDK.
BUB_ACP_SERVER_VERSION = "0.1.1"
# bub-acp-server 0.1.1 pins this pre-release. uv accepts a pre-release only when a direct requirement names it, so the
BUB_ACP_SERVER_VERSION = "0.1.3"
# bub-acp-server 0.1.3 pins this pre-release. uv accepts a pre-release only when a direct requirement names it, so the
# install must repeat the pin or it cannot resolve the server at all. A server release that pins another SDK version
# conflicts with this requirement and fails to install.
ACP_SDK_REQUIREMENT = "agent-client-protocol==1.0.0rc2"
Expand Down Expand Up @@ -176,7 +176,7 @@ def _install_bub_command(*, powercontext: bool = True) -> str:
"fi; "
f"SETUPTOOLS_SCM_PRETEND_VERSION={shlex.quote(POWERCONTEXT_VERSION)} {_tool_environment()} "
f"{uv} tool install --force {plugin}"
f"{shlex.quote(f'bub=={BUB_VERSION}')}"
f"{shlex.quote(f'bub[app]=={BUB_VERSION}')}"
)


Expand All @@ -189,5 +189,5 @@ def _install_acp_server_command() -> str:
f"BUB_PROJECT={REMOTE_BUB_PROJECT} "
f"{_tool_environment()} {REMOTE_BIN_DIR}/bub install "
f"{shlex.quote(f'bub-acp-server=={BUB_ACP_SERVER_VERSION}')} {shlex.quote(ACP_SDK_REQUIREMENT)} "
f"{shlex.quote(f'bub=={BUB_VERSION}')}"
f"{shlex.quote(f'bub[app]=={BUB_VERSION}')}"
)
7 changes: 4 additions & 3 deletions e2e/bub/tests/test_bub_core_compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@

entry = next(e for e in importlib.metadata.entry_points(group="bub") if e.name == "powercontext")
plugin_type = entry.load()
from bub.hooks.interception import LlmCallRequest
import republic
from bub.hooks.interception import LLMCallRequest
from powercontext.client import PowerContextClient
from powercontext_bub import plugin, tools

Expand All @@ -71,10 +72,10 @@ def open_client(base_url, **kwargs):
return PowerContextClient(base_url, http_client=transport, trust_transport_security=True)
plugin.open_client = tools.open_client = open_client
result = await instance.before_llm_call(
LlmCallRequest(run_id="compatibility", model="test", messages=[{"role": "user", "content": "test"}]),
LLMCallRequest(run_id="compatibility", model="test", messages=[republic.user("test")]),
state,
)
assert result is not None and result.messages[0]["content"].endswith("context")
assert result is not None and result.messages[0].text.endswith("context")
assert await tools.prepare_context.run(query="test", context=SimpleNamespace(state=state)) == "context"

for value in [None, {}, {"sections": []}, {"sections": [{"family": "memory", "limit": 3}]}]:
Expand Down
7 changes: 4 additions & 3 deletions e2e/bub/tests/test_bub_recall_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
from typing import Any, ClassVar

import pytest
from bub.hooks.interception import LlmCallRequest
import republic
from bub.hooks.interception import LLMCallRequest
from powercontext_bub import plugin as plugin_module
from powercontext_bub.plugin import PowerContextPlugin, PowerContextSettings

Expand Down Expand Up @@ -64,10 +65,10 @@ def test_recall_query_keeps_the_end_of_the_prompt(monkeypatch, tmp_path: Path, c
monkeypatch.setattr(plugin_module, "PowerContextClient", RecordingClient)
plugin = PowerContextPlugin(SimpleNamespace(workspace=tmp_path))
state = plugin.load_state(message=None, session_id="session-1")
request = LlmCallRequest(
request = LLMCallRequest(
run_id="run-1",
model="test-model",
messages=[{"role": "user", "content": _expand(case["prompt"])}],
messages=[republic.user(_expand(case["prompt"]))],
)

result = asyncio.run(plugin.before_llm_call(request, state))
Expand Down
7 changes: 4 additions & 3 deletions e2e/bub/tests/test_bub_scope_binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
from types import SimpleNamespace
from typing import Any, ClassVar

from bub.hooks.interception import LlmCallRequest
import republic
from bub.hooks.interception import LLMCallRequest
from powercontext_bub import plugin as plugin_module
from powercontext_bub import tools as tools_module
from powercontext_bub.plugin import STATE_KEY, PowerContextPlugin, PowerContextSettings
Expand Down Expand Up @@ -96,10 +97,10 @@ def test_recall_and_capture_use_only_the_server_resolved_scope(monkeypatch, tmp_
state = plugin.load_state(message=None, session_id="session-1")
state["session_id"] = "session-1"

request = LlmCallRequest(
request = LLMCallRequest(
run_id="run-1",
model="test-model",
messages=[{"role": "user", "content": "What did we decide?"}],
messages=[republic.user("What did we decide?")],
)
result = asyncio.run(plugin.before_llm_call(request, state))

Expand Down
4 changes: 2 additions & 2 deletions e2e/bub/tests/test_harbor_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_off_arm_installs_bub_without_the_powercontext_plugin() -> None:
command = _install_bub_command(powercontext=False)

assert "integrations/bub" not in command
assert f"bub=={version('bub')}" in command
assert f"bub[app]=={version('bub')}" in command


def test_acp_server_install_names_the_pre_release_sdk_and_keeps_the_harness_bub() -> None:
Expand All @@ -68,7 +68,7 @@ def test_acp_server_install_names_the_pre_release_sdk_and_keeps_the_harness_bub(
assert set(command[install_index + 1 :]) == {
f"bub-acp-server=={BUB_ACP_SERVER_VERSION}",
ACP_SDK_REQUIREMENT,
f"bub=={version('bub')}",
f"bub[app]=={version('bub')}",
}


Expand Down
Loading
Loading