Rinomina: crate akode-*, cartelle akode-rs/ e akode-cli/, binario akode, ~/.akode, AKODE_* (A)
Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
10
scripts/debug-akode.sh
Executable file
10
scripts/debug-akode.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set "chatgpt.cliExecutable": "/Users/<USERNAME>/code/codex/scripts/debug-akode.sh" in VSCode settings to always get the
|
||||
# latest akode-rs binary when debugging Codex Extension.
|
||||
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
AKODE_RS_DIR=$(realpath "$(dirname "$0")/../akode-rs")
|
||||
(cd "$AKODE_RS_DIR" && cargo run --quiet --bin akode -- "$@")
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set "chatgpt.cliExecutable": "/Users/<USERNAME>/code/codex/scripts/debug-codex.sh" in VSCode settings to always get the
|
||||
# latest codex-rs binary when debugging Codex Extension.
|
||||
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
CODEX_RS_DIR=$(realpath "$(dirname "$0")/../codex-rs")
|
||||
(cd "$CODEX_RS_DIR" && cargo run --quiet --bin codex -- "$@")
|
||||
@@ -41,7 +41,7 @@ def just_formatter_group(*, check: bool) -> FormatterGroup:
|
||||
|
||||
|
||||
def rust_formatter_group(*, check: bool) -> FormatterGroup:
|
||||
rust_workspace = REPO_ROOT / "codex-rs"
|
||||
rust_workspace = REPO_ROOT / "akode-rs"
|
||||
repository_files = subprocess.check_output(
|
||||
[
|
||||
"git",
|
||||
|
||||
@@ -25,7 +25,7 @@ done
|
||||
manual_rust_test_targets="$(
|
||||
./.github/scripts/run-bazel-query-ci.sh \
|
||||
--output=label \
|
||||
-- 'kind("rust_test rule", attr(tags, "manual", //codex-rs/... except //codex-rs/v8-poc/...))'
|
||||
-- 'kind("rust_test rule", attr(tags, "manual", //akode-rs/... except //akode-rs/v8-poc/...))'
|
||||
)"
|
||||
if [[ "${RUNNER_OS:-}" != "Windows" ]]; then
|
||||
# Non-Windows clippy jobs lint the native test binaries; the
|
||||
@@ -42,8 +42,8 @@ elif [[ $windows_cross_compile -eq 1 ]]; then
|
||||
fi
|
||||
|
||||
printf '%s\n' \
|
||||
"//codex-rs/..." \
|
||||
"-//codex-rs/v8-poc:all"
|
||||
"//akode-rs/..." \
|
||||
"-//akode-rs/v8-poc:all"
|
||||
|
||||
# `--config=clippy` on the `workspace_root_test` wrappers does not lint the
|
||||
# underlying `rust_test` binaries. Add the internal manual `*-unit-tests-bin`
|
||||
|
||||
@@ -14,6 +14,6 @@ cd "${repo_root}"
|
||||
# The normal test job covers the Wine smoke test; omit its downloaded runtime
|
||||
# and cross-compile from this build-only release sweep.
|
||||
printf '%s\n' \
|
||||
"//codex-rs/..." \
|
||||
"-//codex-rs/core/tests/remote_env_windows:smoke-test" \
|
||||
"-//codex-rs/v8-poc:all"
|
||||
"//akode-rs/..." \
|
||||
"-//akode-rs/core/tests/remote_env_windows:smoke-test" \
|
||||
"-//akode-rs/v8-poc:all"
|
||||
|
||||
@@ -15,14 +15,14 @@ First install the frozen workspace dependencies and build Codex:
|
||||
|
||||
```bash
|
||||
pnpm install --frozen-lockfile
|
||||
cargo build --locked --manifest-path codex-rs/Cargo.toml -p codex-cli --bin codex
|
||||
cargo build --locked --manifest-path akode-rs/Cargo.toml -p akode-cli --bin codex
|
||||
```
|
||||
|
||||
From a published Codex checkout, run:
|
||||
|
||||
```bash
|
||||
python3 scripts/mcp_conformance/run_codex_compliance.py \
|
||||
codex-rs/target/debug/codex \
|
||||
akode-rs/target/debug/codex \
|
||||
--conformance-cli node_modules/@modelcontextprotocol/conformance/dist/index.js \
|
||||
--baseline-report scripts/mcp_conformance/regression-baseline-v1.json \
|
||||
--report /tmp/codex-mcp-conformance.json
|
||||
@@ -109,13 +109,13 @@ env PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
|
||||
## Run the required SDK integration
|
||||
|
||||
The existing required SDK workflow runs the complete Python fixture self-tests.
|
||||
Its TypeScript job builds the actual Codex executable, sets `CODEX_EXEC_PATH`,
|
||||
Its TypeScript job builds the actual Codex executable, sets `AKODE_EXEC_PATH`,
|
||||
installs the pinned upstream conformance runner, and runs both the official
|
||||
authenticated suite and the separate production reviewer regression matrix.
|
||||
Neither gate can be skipped. To reproduce the focused integration locally:
|
||||
|
||||
```bash
|
||||
CODEX_EXEC_PATH=/absolute/path/to/codex \
|
||||
AKODE_EXEC_PATH=/absolute/path/to/codex \
|
||||
pnpm --filter @openai/codex-sdk test -- \
|
||||
--runInBand tests/mcpConformance.test.ts
|
||||
```
|
||||
|
||||
@@ -43,7 +43,7 @@ class AdapterFailure(RuntimeError):
|
||||
|
||||
CIMD_CLIENT_METADATA_URL = "https://conformance-test.local/client-metadata.json"
|
||||
PRE_REGISTERED_CLIENT_SECRET_ENV_VAR = "MCP_CONFORMANCE_CLIENT_SECRET"
|
||||
CLIENT_REGISTRATION_OVERRIDE_ENV_VAR = "CODEX_CONFORMANCE_CLIENT_REGISTRATION"
|
||||
CLIENT_REGISTRATION_OVERRIDE_ENV_VAR = "AKODE_CONFORMANCE_CLIENT_REGISTRATION"
|
||||
AUTH_COMPLETION_METHOD = "mcpServer/oauthLogin/completed"
|
||||
EXPECTED_AUTH_REJECTION_SCENARIOS = frozenset(
|
||||
{
|
||||
@@ -700,16 +700,16 @@ def _exercise_scenario(
|
||||
|
||||
|
||||
def run_adapter(server_url: str) -> dict[str, object]:
|
||||
codex_binary = _required_path("CODEX_CONFORMANCE_BINARY")
|
||||
codex_home = _required_path("CODEX_CONFORMANCE_HOME")
|
||||
codex_binary = _required_path("AKODE_CONFORMANCE_BINARY")
|
||||
codex_home = _required_path("AKODE_CONFORMANCE_HOME")
|
||||
scenario = _required_env("MCP_CONFORMANCE_SCENARIO")
|
||||
protocol_version = _required_env("MCP_CONFORMANCE_PROTOCOL_VERSION")
|
||||
timeout_seconds = float(os.environ.get("CODEX_CONFORMANCE_TIMEOUT", "30"))
|
||||
timeout_seconds = float(os.environ.get("AKODE_CONFORMANCE_TIMEOUT", "30"))
|
||||
enable_modern_feature = (
|
||||
os.environ.get("CODEX_CONFORMANCE_ENABLE_MODERN_FEATURE", "1") != "0"
|
||||
os.environ.get("AKODE_CONFORMANCE_ENABLE_MODERN_FEATURE", "1") != "0"
|
||||
)
|
||||
require_automatic_auth = (
|
||||
os.environ.get("CODEX_CONFORMANCE_REQUIRE_AUTOMATIC_AUTH", "0") == "1"
|
||||
os.environ.get("AKODE_CONFORMANCE_REQUIRE_AUTOMATIC_AUTH", "0") == "1"
|
||||
)
|
||||
context = _conformance_context()
|
||||
|
||||
@@ -971,7 +971,7 @@ def run_adapter(server_url: str) -> dict[str, object]:
|
||||
|
||||
def main(argv: Sequence[str] | None = None) -> int:
|
||||
values = list(sys.argv[1:] if argv is None else argv)
|
||||
report_path_value = os.environ.get("CODEX_CONFORMANCE_ADAPTER_REPORT")
|
||||
report_path_value = os.environ.get("AKODE_CONFORMANCE_ADAPTER_REPORT")
|
||||
report: dict[str, object]
|
||||
try:
|
||||
if len(values) != 1:
|
||||
|
||||
@@ -252,7 +252,7 @@ def _make_adapter_launcher(
|
||||
adapter_command = subprocess.list2cmdline([sys.executable, str(adapter_script)])
|
||||
launcher.write_text(
|
||||
"@echo off\n"
|
||||
f'set "CODEX_CONFORMANCE_REQUIRE_AUTOMATIC_AUTH={automatic_auth}"\n'
|
||||
f'set "AKODE_CONFORMANCE_REQUIRE_AUTOMATIC_AUTH={automatic_auth}"\n'
|
||||
f"{adapter_command} %*\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
@@ -260,7 +260,7 @@ def _make_adapter_launcher(
|
||||
launcher = launcher_dir / "client"
|
||||
launcher.write_text(
|
||||
"#!/bin/sh\n"
|
||||
f"export CODEX_CONFORMANCE_REQUIRE_AUTOMATIC_AUTH={automatic_auth}\n"
|
||||
f"export AKODE_CONFORMANCE_REQUIRE_AUTOMATIC_AUTH={automatic_auth}\n"
|
||||
f'exec {shlex.quote(sys.executable)} {shlex.quote(str(adapter_script))} "$@"\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
@@ -382,15 +382,15 @@ def _run_scenario(
|
||||
scenario_dir = output_dir / _safe_scenario_name(scenario)
|
||||
scenario_dir.mkdir(parents=True, exist_ok=True)
|
||||
adapter_report = scenario_dir / "codex-adapter.json"
|
||||
adapter_home = scenario_dir / "codex-home"
|
||||
adapter_home = scenario_dir / "akode-home"
|
||||
adapter_home.mkdir()
|
||||
|
||||
env = dict(base_env)
|
||||
env.update(
|
||||
{
|
||||
"CODEX_CONFORMANCE_BINARY": str(codex_binary),
|
||||
"CODEX_CONFORMANCE_HOME": str(adapter_home),
|
||||
"CODEX_CONFORMANCE_ADAPTER_REPORT": str(adapter_report),
|
||||
"AKODE_CONFORMANCE_BINARY": str(codex_binary),
|
||||
"AKODE_CONFORMANCE_HOME": str(adapter_home),
|
||||
"AKODE_CONFORMANCE_ADAPTER_REPORT": str(adapter_report),
|
||||
}
|
||||
)
|
||||
command = [
|
||||
@@ -493,7 +493,7 @@ def run_official_mode(
|
||||
) -> list[OfficialScenarioResult]:
|
||||
launcher = _make_adapter_launcher(
|
||||
adapter_script,
|
||||
require_automatic_auth=base_env.get("CODEX_CONFORMANCE_REQUIRE_AUTOMATIC_AUTH")
|
||||
require_automatic_auth=base_env.get("AKODE_CONFORMANCE_REQUIRE_AUTOMATIC_AUTH")
|
||||
== "1",
|
||||
)
|
||||
try:
|
||||
|
||||
@@ -130,7 +130,7 @@ def _review_registration_command(
|
||||
command.extend(
|
||||
[
|
||||
"--env",
|
||||
f"CODEX_MCP_PROTOCOL_VERSION={protocol_environment}",
|
||||
f"AKODE_MCP_PROTOCOL_VERSION={protocol_environment}",
|
||||
"--",
|
||||
sys.executable,
|
||||
str(server_script),
|
||||
|
||||
@@ -454,9 +454,9 @@ def _result_detail(
|
||||
|
||||
def _isolated_environment(codex_home: Path) -> dict[str, str]:
|
||||
env = dict(os.environ)
|
||||
env["CODEX_HOME"] = str(codex_home)
|
||||
env["AKODE_HOME"] = str(codex_home)
|
||||
# Direct app-server MCP calls do not need a model or credentials.
|
||||
for name in ("CODEX_API_KEY", "CODEX_ACCESS_TOKEN", "OPENAI_API_KEY"):
|
||||
for name in ("AKODE_API_KEY", "AKODE_ACCESS_TOKEN", "OPENAI_API_KEY"):
|
||||
env.pop(name, None)
|
||||
return env
|
||||
|
||||
@@ -495,7 +495,7 @@ def _registration_command(
|
||||
command = [str(codex_binary), "mcp", "add", TEST_SERVER_NAME]
|
||||
if transport == "stdio":
|
||||
if mode == MODERN_VERSION:
|
||||
command.extend(["--env", f"CODEX_MCP_PROTOCOL_VERSION={MODERN_VERSION}"])
|
||||
command.extend(["--env", f"AKODE_MCP_PROTOCOL_VERSION={MODERN_VERSION}"])
|
||||
return [
|
||||
*command,
|
||||
"--",
|
||||
@@ -531,7 +531,7 @@ def _validate_registration(
|
||||
env = value.get("env")
|
||||
modern_opt_in = (
|
||||
isinstance(env, dict)
|
||||
and env.get("CODEX_MCP_PROTOCOL_VERSION") == MODERN_VERSION
|
||||
and env.get("AKODE_MCP_PROTOCOL_VERSION") == MODERN_VERSION
|
||||
)
|
||||
if mode == MODERN_VERSION and not modern_opt_in:
|
||||
return False, "modern stdio registration omitted its protocol opt-in"
|
||||
@@ -1155,11 +1155,11 @@ def _run_official_case(
|
||||
case = CaseResult(transport="official-http", mode=mode)
|
||||
case_home.mkdir(parents=True)
|
||||
env = _isolated_environment(case_home)
|
||||
env["CODEX_CONFORMANCE_TIMEOUT"] = str(timeout_seconds)
|
||||
env["CODEX_CONFORMANCE_ENABLE_MODERN_FEATURE"] = (
|
||||
env["AKODE_CONFORMANCE_TIMEOUT"] = str(timeout_seconds)
|
||||
env["AKODE_CONFORMANCE_ENABLE_MODERN_FEATURE"] = (
|
||||
"1" if enable_modern_feature else "0"
|
||||
)
|
||||
env["CODEX_CONFORMANCE_REQUIRE_AUTOMATIC_AUTH"] = (
|
||||
env["AKODE_CONFORMANCE_REQUIRE_AUTOMATIC_AUTH"] = (
|
||||
"1" if require_automatic_auth else "0"
|
||||
)
|
||||
results = run_official_mode(
|
||||
@@ -1266,13 +1266,13 @@ def _cimd_registration_checks(
|
||||
("forced_cimd", "cimd"),
|
||||
):
|
||||
env = _isolated_environment(case_home / check_name)
|
||||
env["CODEX_CONFORMANCE_TIMEOUT"] = str(timeout_seconds)
|
||||
env["CODEX_CONFORMANCE_ENABLE_MODERN_FEATURE"] = (
|
||||
env["AKODE_CONFORMANCE_TIMEOUT"] = str(timeout_seconds)
|
||||
env["AKODE_CONFORMANCE_ENABLE_MODERN_FEATURE"] = (
|
||||
"1" if enable_modern_feature else "0"
|
||||
)
|
||||
env["CODEX_CONFORMANCE_REQUIRE_AUTOMATIC_AUTH"] = "1"
|
||||
env["AKODE_CONFORMANCE_REQUIRE_AUTOMATIC_AUTH"] = "1"
|
||||
if client_registration is not None:
|
||||
env["CODEX_CONFORMANCE_CLIENT_REGISTRATION"] = client_registration
|
||||
env["AKODE_CONFORMANCE_CLIENT_REGISTRATION"] = client_registration
|
||||
results = run_official_mode(
|
||||
conformance_command=conformance_command,
|
||||
adapter_script=adapter_script,
|
||||
|
||||
@@ -705,7 +705,7 @@ class ProtocolServer:
|
||||
"structuredContent": structured,
|
||||
}
|
||||
elif name == "review_protocol_env":
|
||||
structured = {"value": os.environ.get("CODEX_MCP_PROTOCOL_VERSION")}
|
||||
structured = {"value": os.environ.get("AKODE_MCP_PROTOCOL_VERSION")}
|
||||
fields = {
|
||||
"content": [{"type": "text", "text": json.dumps(structured)}],
|
||||
"structuredContent": structured,
|
||||
|
||||
@@ -64,7 +64,7 @@ def test_registration_commands_select_stdio_then_http_shapes() -> None:
|
||||
"add",
|
||||
TEST_SERVER_NAME,
|
||||
"--env",
|
||||
f"CODEX_MCP_PROTOCOL_VERSION={MODERN_VERSION}",
|
||||
f"AKODE_MCP_PROTOCOL_VERSION={MODERN_VERSION}",
|
||||
"--",
|
||||
sys.executable,
|
||||
"/src/server.py",
|
||||
@@ -120,7 +120,7 @@ def test_registration_validation_checks_transport_and_mode() -> None:
|
||||
"--transport",
|
||||
"stdio",
|
||||
],
|
||||
"env": {"CODEX_MCP_PROTOCOL_VERSION": MODERN_VERSION},
|
||||
"env": {"AKODE_MCP_PROTOCOL_VERSION": MODERN_VERSION},
|
||||
},
|
||||
},
|
||||
transport="stdio",
|
||||
@@ -207,15 +207,15 @@ def test_isolated_environment_drops_model_credentials(
|
||||
tmp_path: Path,
|
||||
monkeypatch,
|
||||
) -> None:
|
||||
monkeypatch.setenv("CODEX_API_KEY", "secret")
|
||||
monkeypatch.setenv("CODEX_ACCESS_TOKEN", "secret")
|
||||
monkeypatch.setenv("AKODE_API_KEY", "secret")
|
||||
monkeypatch.setenv("AKODE_ACCESS_TOKEN", "secret")
|
||||
monkeypatch.setenv("OPENAI_API_KEY", "secret")
|
||||
|
||||
env = _isolated_environment(tmp_path)
|
||||
|
||||
assert env["CODEX_HOME"] == str(tmp_path)
|
||||
assert "CODEX_API_KEY" not in env
|
||||
assert "CODEX_ACCESS_TOKEN" not in env
|
||||
assert env["AKODE_HOME"] == str(tmp_path)
|
||||
assert "AKODE_API_KEY" not in env
|
||||
assert "AKODE_ACCESS_TOKEN" not in env
|
||||
assert "OPENAI_API_KEY" not in env
|
||||
assert env.get("PATH") == os.environ.get("PATH")
|
||||
|
||||
@@ -574,8 +574,8 @@ def test_official_case_keeps_cimd_registration_checks_in_regression_gated_http_c
|
||||
forced_env = calls[2]["base_env"]
|
||||
assert isinstance(auto_env, dict)
|
||||
assert isinstance(forced_env, dict)
|
||||
assert auto_env.get("CODEX_CONFORMANCE_CLIENT_REGISTRATION") is None
|
||||
assert forced_env["CODEX_CONFORMANCE_CLIENT_REGISTRATION"] == "cimd"
|
||||
assert auto_env.get("AKODE_CONFORMANCE_CLIENT_REGISTRATION") is None
|
||||
assert forced_env["AKODE_CONFORMANCE_CLIENT_REGISTRATION"] == "cimd"
|
||||
|
||||
|
||||
def _regression_report() -> dict[str, object]:
|
||||
|
||||
@@ -121,7 +121,7 @@ def test_official_adapter_launcher_preserves_strict_production_auth_mode(
|
||||
) -> None:
|
||||
adapter = tmp_path / "show_automatic_auth.py"
|
||||
adapter.write_text(
|
||||
'import os\nprint(os.environ.get("CODEX_CONFORMANCE_REQUIRE_AUTOMATIC_AUTH", ""))\n',
|
||||
'import os\nprint(os.environ.get("AKODE_CONFORMANCE_REQUIRE_AUTOMATIC_AUTH", ""))\n',
|
||||
encoding="utf-8",
|
||||
)
|
||||
launcher = _make_adapter_launcher(adapter, require_automatic_auth=True)
|
||||
@@ -165,7 +165,7 @@ def test_windows_official_adapter_launcher_quotes_checkout_paths(
|
||||
assert launcher.name == "client.cmd"
|
||||
assert contents.startswith("@echo off\n")
|
||||
assert (
|
||||
f'set "CODEX_CONFORMANCE_REQUIRE_AUTOMATIC_AUTH={expected_auth}"\n' in contents
|
||||
f'set "AKODE_CONFORMANCE_REQUIRE_AUTOMATIC_AUTH={expected_auth}"\n' in contents
|
||||
)
|
||||
assert subprocess.list2cmdline([sys.executable, str(adapter)]) + " %*\n" in contents
|
||||
|
||||
@@ -428,7 +428,7 @@ def test_official_diagnostics_redact_oauth_secrets() -> None:
|
||||
|
||||
|
||||
def test_retained_artifacts_remove_oauth_credential_store(tmp_path: Path) -> None:
|
||||
codex_home = tmp_path / "codex-home"
|
||||
codex_home = tmp_path / "akode-home"
|
||||
codex_home.mkdir()
|
||||
credentials = codex_home / ".credentials.json"
|
||||
credentials.write_text('{"client_secret":"do-not-retain"}', encoding="utf-8")
|
||||
@@ -584,7 +584,7 @@ result_dir.mkdir(parents=True)
|
||||
"status": "SUCCESS",
|
||||
},
|
||||
]))
|
||||
pathlib.Path(os.environ["CODEX_CONFORMANCE_ADAPTER_REPORT"]).write_text(
|
||||
pathlib.Path(os.environ["AKODE_CONFORMANCE_ADAPTER_REPORT"]).write_text(
|
||||
json.dumps({"success": True, "steps": []})
|
||||
)
|
||||
""".lstrip(),
|
||||
@@ -664,7 +664,7 @@ import pathlib
|
||||
import time
|
||||
|
||||
time.sleep(0.1)
|
||||
pathlib.Path(os.environ["CODEX_CONFORMANCE_ADAPTER_REPORT"]).write_text(
|
||||
pathlib.Path(os.environ["AKODE_CONFORMANCE_ADAPTER_REPORT"]).write_text(
|
||||
json.dumps({"success": True, "steps": []})
|
||||
)
|
||||
'''
|
||||
|
||||
@@ -233,7 +233,7 @@ def test_shipping_legacy_registration_preserves_the_reserved_protocol_environmen
|
||||
"add",
|
||||
"mcp_spec_fixture",
|
||||
"--env",
|
||||
f"CODEX_MCP_PROTOCOL_VERSION={LEGACY_ENVIRONMENT_SENTINEL}",
|
||||
f"AKODE_MCP_PROTOCOL_VERSION={LEGACY_ENVIRONMENT_SENTINEL}",
|
||||
"--",
|
||||
sys.executable,
|
||||
"/src/server.py",
|
||||
@@ -256,7 +256,7 @@ def test_modern_registration_explicitly_opts_into_the_modern_protocol() -> None:
|
||||
http_url=None,
|
||||
)
|
||||
|
||||
assert f"CODEX_MCP_PROTOCOL_VERSION={MODERN_VERSION}" in command
|
||||
assert f"AKODE_MCP_PROTOCOL_VERSION={MODERN_VERSION}" in command
|
||||
|
||||
|
||||
def test_http_review_registration_requires_a_real_fixture_url() -> None:
|
||||
|
||||
@@ -891,7 +891,7 @@ def test_review_protocol_env_is_available_to_a_legacy_client() -> None:
|
||||
assert any(tool["name"] == "review_protocol_env" for tool in tools["tools"])
|
||||
|
||||
with patch.dict(
|
||||
"os.environ", {"CODEX_MCP_PROTOCOL_VERSION": "legacy-review-sentinel"}
|
||||
"os.environ", {"AKODE_MCP_PROTOCOL_VERSION": "legacy-review-sentinel"}
|
||||
):
|
||||
plan = server.handle(
|
||||
request(
|
||||
@@ -913,7 +913,7 @@ def test_review_protocol_env_is_available_to_the_shipping_legacy_client() -> Non
|
||||
assert any(tool["name"] == "review_protocol_env" for tool in tools["tools"])
|
||||
|
||||
with patch.dict(
|
||||
"os.environ", {"CODEX_MCP_PROTOCOL_VERSION": "shipping-legacy-sentinel"}
|
||||
"os.environ", {"AKODE_MCP_PROTOCOL_VERSION": "shipping-legacy-sentinel"}
|
||||
):
|
||||
plan = server.handle(
|
||||
request(
|
||||
@@ -929,7 +929,7 @@ def test_review_protocol_env_is_available_to_the_shipping_legacy_client() -> Non
|
||||
def test_review_protocol_env_is_available_to_a_modern_client() -> None:
|
||||
server = ProtocolServer(MODERN_VERSION, profile=REVIEW_PROFILE)
|
||||
|
||||
with patch.dict("os.environ", {"CODEX_MCP_PROTOCOL_VERSION": MODERN_VERSION}):
|
||||
with patch.dict("os.environ", {"AKODE_MCP_PROTOCOL_VERSION": MODERN_VERSION}):
|
||||
plan = server.handle(
|
||||
request(
|
||||
"tools/call",
|
||||
|
||||
@@ -122,7 +122,7 @@ async def _handle_connection(
|
||||
sys.stdout.write(f"[conn] {_utc_iso()} send {_dump_json(ev)}\n")
|
||||
await websocket.send(_dump_json(ev))
|
||||
|
||||
# Request 1: provoke a function call (mirrors `codex-rs/core/tests/suite/agent_websocket.rs`).
|
||||
# Request 1: provoke a function call (mirrors `akode-rs/core/tests/suite/agent_websocket.rs`).
|
||||
await recv_json("req1")
|
||||
await send_event(_event_response_created("resp-1"))
|
||||
await send_event(_event_function_call(CALL_ID, FUNCTION_NAME, FUNCTION_ARGS_JSON))
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
set -euo pipefail
|
||||
|
||||
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cargo_root="$repo_root/codex-rs"
|
||||
listen_url="${CODEX_EXEC_SERVER_LISTEN_URL:-ws://127.0.0.1:0}"
|
||||
start_timeout_seconds="${CODEX_EXEC_SERVER_START_TIMEOUT_SECONDS:-120}"
|
||||
cargo_root="$repo_root/akode-rs"
|
||||
listen_url="${AKODE_EXEC_SERVER_LISTEN_URL:-ws://127.0.0.1:0}"
|
||||
start_timeout_seconds="${AKODE_EXEC_SERVER_START_TIMEOUT_SECONDS:-120}"
|
||||
tmp_dir="$(mktemp -d "${TMPDIR:-/tmp}/codex-tui-with-exec-server.XXXXXX")"
|
||||
stdout_log="$tmp_dir/exec-server.stdout"
|
||||
stderr_log="$tmp_dir/exec-server.stderr"
|
||||
@@ -24,7 +24,7 @@ trap cleanup EXIT INT TERM HUP
|
||||
|
||||
(
|
||||
cd "$cargo_root"
|
||||
cargo run -p codex-cli --bin codex -- exec-server --listen "$listen_url"
|
||||
cargo run -p akode-cli --bin akode -- exec-server --listen "$listen_url"
|
||||
) >"$stdout_log" 2>"$stderr_log" &
|
||||
server_pid="$!"
|
||||
|
||||
@@ -40,7 +40,7 @@ for _ in $(seq 1 "$((start_timeout_seconds * 20))"); do
|
||||
if ! kill -0 "$server_pid" >/dev/null 2>&1; then
|
||||
cat "$stderr_log" >&2 || true
|
||||
cat "$stdout_log" >&2 || true
|
||||
echo "failed to start codex exec-server" >&2
|
||||
echo "failed to start akode exec-server" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -50,12 +50,12 @@ done
|
||||
if [[ -z "$exec_server_url" ]]; then
|
||||
cat "$stderr_log" >&2 || true
|
||||
cat "$stdout_log" >&2 || true
|
||||
echo "timed out waiting ${start_timeout_seconds}s for codex exec-server to report its websocket URL" >&2
|
||||
echo "timed out waiting ${start_timeout_seconds}s for akode exec-server to report its websocket URL" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export CODEX_EXEC_SERVER_URL="$exec_server_url"
|
||||
echo "Starting codex-tui with CODEX_EXEC_SERVER_URL=$CODEX_EXEC_SERVER_URL" >&2
|
||||
export AKODE_EXEC_SERVER_URL="$exec_server_url"
|
||||
echo "Starting akode-tui with AKODE_EXEC_SERVER_URL=$AKODE_EXEC_SERVER_URL" >&2
|
||||
|
||||
cd "$cargo_root"
|
||||
cargo run -p codex-tui --bin codex-tui -- -c mcp_oauth_credentials_store=file "$@"
|
||||
cargo run -p akode-tui --bin akode-tui -- -c mcp_oauth_credentials_store=file "$@"
|
||||
|
||||
@@ -22,8 +22,8 @@ remote_host="$1"
|
||||
shift
|
||||
|
||||
remote_path='~/code/codex-sync'
|
||||
local_exec_server_port="${CODEX_REMOTE_EXEC_SERVER_LOCAL_PORT:-8765}"
|
||||
remote_exec_server_start_timeout_seconds="${CODEX_REMOTE_EXEC_SERVER_START_TIMEOUT_SECONDS:-15}"
|
||||
local_exec_server_port="${AKODE_REMOTE_EXEC_SERVER_LOCAL_PORT:-8765}"
|
||||
remote_exec_server_start_timeout_seconds="${AKODE_REMOTE_EXEC_SERVER_START_TIMEOUT_SECONDS:-15}"
|
||||
|
||||
remote_exec_server_pid=''
|
||||
remote_exec_server_log_path=''
|
||||
@@ -77,7 +77,7 @@ rsync \
|
||||
--human-readable \
|
||||
--itemize-changes \
|
||||
--exclude '.git/' \
|
||||
--exclude 'codex-rs/target/' \
|
||||
--exclude 'akode-rs/target/' \
|
||||
--filter=':- .gitignore' \
|
||||
"$@" \
|
||||
"${repo_root}/" \
|
||||
@@ -98,13 +98,13 @@ remote_exec_server_log_path="$1"
|
||||
remote_exec_server_pid_path="$2"
|
||||
remote_exec_server_start_timeout_seconds="$3"
|
||||
remote_repo_root="$HOME/code/codex-sync"
|
||||
remote_codex_rs="$remote_repo_root/codex-rs"
|
||||
remote_codex_rs="$remote_repo_root/akode-rs"
|
||||
|
||||
cd "${remote_codex_rs}"
|
||||
cargo build -p codex-cli --bin codex
|
||||
cargo build -p akode-cli --bin akode
|
||||
|
||||
rm -f "${remote_exec_server_log_path}" "${remote_exec_server_pid_path}"
|
||||
nohup ./target/debug/codex exec-server --listen ws://127.0.0.1:0 \
|
||||
nohup ./target/debug/akode exec-server --listen ws://127.0.0.1:0 \
|
||||
>"${remote_exec_server_log_path}" 2>&1 &
|
||||
remote_exec_server_pid="$!"
|
||||
echo "${remote_exec_server_pid}" >"${remote_exec_server_pid_path}"
|
||||
@@ -169,8 +169,8 @@ fi
|
||||
echo "Remote exec server: ${listen_url}"
|
||||
echo "Remote exec server log: ${remote_exec_server_log_path}"
|
||||
echo "Press Ctrl-C to stop the SSH tunnel and remote exec server."
|
||||
echo "Start codex via: "
|
||||
printf ' CODEX_EXEC_SERVER_URL=ws://127.0.0.1:%s codex -C %q\n' \
|
||||
echo "Start akode via: "
|
||||
printf ' AKODE_EXEC_SERVER_URL=ws://127.0.0.1:%s akode -C %q\n' \
|
||||
"${local_exec_server_port}" \
|
||||
"${remote_repo_root}"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Remote-env setup script for codex-rs integration tests.
|
||||
# Remote-env setup script for akode-rs integration tests.
|
||||
#
|
||||
# Usage (source-only):
|
||||
# source scripts/test-remote-env.sh
|
||||
# cd codex-rs
|
||||
# just test -p codex-core --test all remote_test_env_can_connect_and_use_filesystem
|
||||
# cd akode-rs
|
||||
# just test -p akode-core --test all remote_test_env_can_connect_and_use_filesystem
|
||||
# codex_remote_env_cleanup
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
@@ -24,8 +24,8 @@ setup_remote_env() {
|
||||
local remote_exec_server_port
|
||||
local remote_exec_server_stdout_path
|
||||
|
||||
container_name="${CODEX_TEST_REMOTE_ENV_CONTAINER_NAME:-codex-remote-test-env-local-$(date +%s)-${RANDOM}}"
|
||||
codex_binary_path="${CARGO_TARGET_DIR:-${REPO_ROOT}/codex-rs/target}/debug/codex"
|
||||
container_name="${AKODE_TEST_REMOTE_ENV_CONTAINER_NAME:-codex-remote-test-env-local-$(date +%s)-${RANDOM}}"
|
||||
codex_binary_path="${CARGO_TARGET_DIR:-${REPO_ROOT}/akode-rs/target}/debug/akode"
|
||||
|
||||
if ! command -v docker >/dev/null 2>&1; then
|
||||
echo "docker is required (Colima or Docker Desktop)" >&2
|
||||
@@ -43,12 +43,12 @@ setup_remote_env() {
|
||||
fi
|
||||
|
||||
(
|
||||
cd "${REPO_ROOT}/codex-rs"
|
||||
cargo build -p codex-cli --bin codex
|
||||
cd "${REPO_ROOT}/akode-rs"
|
||||
cargo build -p akode-cli --bin akode
|
||||
)
|
||||
|
||||
if [[ ! -f "${codex_binary_path}" ]]; then
|
||||
echo "codex binary not found at ${codex_binary_path}" >&2
|
||||
echo "akode binary not found at ${codex_binary_path}" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -64,7 +64,7 @@ setup_remote_env() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ -z "${CODEX_TEST_REMOTE_EXEC_SERVER_URL:-}" ]]; then
|
||||
if [[ -z "${AKODE_TEST_REMOTE_EXEC_SERVER_URL:-}" ]]; then
|
||||
remote_codex_path="/tmp/codex-remote-env/codex"
|
||||
remote_exec_server_port="31987"
|
||||
remote_exec_server_stdout_path="/tmp/codex-remote-env/exec-server.stdout"
|
||||
@@ -84,13 +84,13 @@ setup_remote_env() {
|
||||
docker rm -f "${container_name}" >/dev/null 2>&1 || true
|
||||
return 1
|
||||
fi
|
||||
export CODEX_TEST_REMOTE_EXEC_SERVER_PID="${remote_exec_server_pid}"
|
||||
export CODEX_TEST_REMOTE_EXEC_SERVER_URL="ws://${container_ip}:${remote_exec_server_port}"
|
||||
export AKODE_TEST_REMOTE_EXEC_SERVER_PID="${remote_exec_server_pid}"
|
||||
export AKODE_TEST_REMOTE_EXEC_SERVER_URL="ws://${container_ip}:${remote_exec_server_port}"
|
||||
fi
|
||||
|
||||
export CODEX_TEST_REMOTE_ENV="${container_name}"
|
||||
export CODEX_TEST_REMOTE_ENV_CONTAINER_NAME="${container_name}"
|
||||
export CODEX_TEST_ENVIRONMENT="docker"
|
||||
export AKODE_TEST_REMOTE_ENV="${container_name}"
|
||||
export AKODE_TEST_REMOTE_ENV_CONTAINER_NAME="${container_name}"
|
||||
export AKODE_TEST_ENVIRONMENT="docker"
|
||||
}
|
||||
|
||||
wait_for_remote_exec_server_port() {
|
||||
@@ -112,14 +112,14 @@ wait_for_remote_exec_server_port() {
|
||||
}
|
||||
|
||||
codex_remote_env_cleanup() {
|
||||
if [[ -n "${CODEX_TEST_REMOTE_ENV:-}" ]]; then
|
||||
docker rm -f "${CODEX_TEST_REMOTE_ENV}" >/dev/null 2>&1 || true
|
||||
unset CODEX_TEST_REMOTE_ENV
|
||||
if [[ -n "${AKODE_TEST_REMOTE_ENV:-}" ]]; then
|
||||
docker rm -f "${AKODE_TEST_REMOTE_ENV}" >/dev/null 2>&1 || true
|
||||
unset AKODE_TEST_REMOTE_ENV
|
||||
fi
|
||||
unset CODEX_TEST_REMOTE_ENV_CONTAINER_NAME
|
||||
unset CODEX_TEST_REMOTE_EXEC_SERVER_PID
|
||||
unset CODEX_TEST_REMOTE_EXEC_SERVER_URL
|
||||
unset CODEX_TEST_ENVIRONMENT
|
||||
unset AKODE_TEST_REMOTE_ENV_CONTAINER_NAME
|
||||
unset AKODE_TEST_REMOTE_EXEC_SERVER_PID
|
||||
unset AKODE_TEST_REMOTE_EXEC_SERVER_URL
|
||||
unset AKODE_TEST_ENVIRONMENT
|
||||
}
|
||||
|
||||
if ! is_sourced; then
|
||||
@@ -131,9 +131,9 @@ old_shell_options="$(set +o)"
|
||||
set -euo pipefail
|
||||
if setup_remote_env; then
|
||||
status=0
|
||||
echo "CODEX_TEST_REMOTE_ENV=${CODEX_TEST_REMOTE_ENV}"
|
||||
echo "CODEX_TEST_ENVIRONMENT=${CODEX_TEST_ENVIRONMENT}"
|
||||
echo "CODEX_TEST_REMOTE_EXEC_SERVER_URL=${CODEX_TEST_REMOTE_EXEC_SERVER_URL}"
|
||||
echo "AKODE_TEST_REMOTE_ENV=${AKODE_TEST_REMOTE_ENV}"
|
||||
echo "AKODE_TEST_ENVIRONMENT=${AKODE_TEST_ENVIRONMENT}"
|
||||
echo "AKODE_TEST_REMOTE_EXEC_SERVER_URL=${AKODE_TEST_REMOTE_EXEC_SERVER_URL}"
|
||||
echo "Remote env ready. Run your command, then call: codex_remote_env_cleanup"
|
||||
else
|
||||
status=$?
|
||||
|
||||
Reference in New Issue
Block a user