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 ATTRIBUTIONS-Python.md
Original file line number Diff line number Diff line change
Expand Up @@ -5465,7 +5465,7 @@ Copyright 2016 Andrew Svetlov and aio-libs contributors
### Licenses
License: `Apache-2.0`

- `licenses/LICENSE`:
- `LICENSE`:
```
Apache License
Version 2.0, January 2004
Expand Down
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ default-members = [
resolver = "2"

[workspace.package]
version = "0.1.0"
version = "0.1.1"
edition = "2024"
license = "Apache-2.0"
repository = "https://github.com/NVIDIA/nemo-fabric"

[workspace.dependencies]
nemo-fabric-core = { path = "crates/fabric-core", version = "0.1.0" }
nemo-fabric-core = { path = "crates/fabric-core", version = "0.1.1" }

clap = { version = "4", default-features = false, features = ["derive", "std", "help", "usage", "error-context", "suggestions"] }
# Validate adapter-owned JSON Schema in Rust while preserving precise instance paths.
Expand Down
4 changes: 2 additions & 2 deletions adapters/claude/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "nemo-fabric-adapters-claude"
version = "0.1.0"
version = "0.1.1"
description = "Claude adapter for NeMo Fabric"
authors = [
{ name = "NVIDIA Corporation" },
Expand All @@ -25,7 +25,7 @@ license-files = ["LICENSE"]
readme = "pypi.md"
requires-python = ">=3.11"
dependencies = [
"nemo-fabric-adapters-common == 0.1.0",
"nemo-fabric-adapters-common == 0.1.1",
"tomli-w~=1.2",
]

Expand Down
41 changes: 38 additions & 3 deletions adapters/claude/src/nemo_fabric_adapters/claude/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
from claude_agent_sdk import HookMatcher
from claude_agent_sdk._errors import MessageParseError
from nemo_fabric_adapters.common import lifecycle
from nemo_fabric_adapters.common import relay_artifacts
from nemo_fabric_adapters.common import relay_gateway
from nemo_fabric_adapters.common import relay_hooks
from nemo_fabric_adapters.common import utils as common_utils
Expand Down Expand Up @@ -726,6 +727,8 @@ def child_environment(
def _relay_output(
output: dict[str, Any],
relay: ClaudeRelaySettings,
*,
artifacts: list[dict[str, str]] | None = None,
) -> dict[str, Any]:
output["relay_runtime"] = {
"enabled": True,
Expand All @@ -735,8 +738,10 @@ def _relay_output(
"gateway_url": relay.gateway.url,
"gateway_log_path": str(relay.gateway.log_path),
}
output["relay_artifacts"] = common_utils.collect_relay_artifacts(
relay.plugin_config
output["relay_artifacts"] = (
common_utils.collect_relay_artifacts(relay.plugin_config)
if artifacts is None
else artifacts
)
return output

Expand Down Expand Up @@ -882,7 +887,7 @@ async def invoke(self, invocation: dict[str, Any]) -> dict[str, Any]:
if self._unusable:
return _failure(
"claude_runtime_unavailable",
"Claude runtime cannot accept another invocation after an SDK failure",
"Claude runtime cannot accept another invocation after a runtime failure",
)

try:
Expand All @@ -891,12 +896,42 @@ async def invoke(self, invocation: dict[str, Any]) -> dict[str, Any]:
except ClaudeAdapterError as error:
output = adapter_failure(error)
else:
relay = self._relay
atif_before = (
relay_artifacts.snapshot_atif_files(relay.plugin_config)
if relay is not None
and relay_artifacts.expects_local_atif(relay.plugin_config)
else None
)
output = await self._run_query(
payload,
client,
prompt,
invocation_timeout,
)
if (
output.get("completed")
and relay is not None
and atif_before is not None
):
finalized = await relay_artifacts.wait_for_finalized_atif(
relay.plugin_config, atif_before
)
if finalized is None:
self._unusable = True
return _relay_output(
adapter_failure(
AdapterRelayError(
"claude_relay_atif_timeout",
"NeMo Relay did not finalize an ATIF artifact before the deadline",
metadata={
"timeout_seconds": relay_artifacts.ATIF_FINALIZATION_TIMEOUT_SECONDS,
},
)
),
relay,
artifacts=[],
)

if self._relay is not None:
output = _relay_output(output, self._relay)
Expand Down
4 changes: 2 additions & 2 deletions adapters/claude/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions adapters/codex/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "nemo-fabric-adapters-codex"
version = "0.1.0"
version = "0.1.1"
description = "Codex adapter for NeMo Fabric"
authors = [
{ name = "NVIDIA Corporation" },
Expand All @@ -25,7 +25,7 @@ license-files = ["LICENSE"]
readme = "pypi.md"
requires-python = ">=3.11"
dependencies = [
"nemo-fabric-adapters-common == 0.1.0",
"nemo-fabric-adapters-common == 0.1.1",
"tomli-w~=1.2",
]

Expand Down
52 changes: 46 additions & 6 deletions adapters/codex/src/nemo_fabric_adapters/codex/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import nemo_fabric_adapters.common.relay_gateway as relay_gateway
import nemo_fabric_adapters.common.relay_hooks as relay_hooks
import nemo_fabric_adapters.common.relay_artifacts as relay_artifacts
import nemo_fabric_adapters.common.utils as common_utils
from nemo_fabric_adapters.common import lifecycle

Expand Down Expand Up @@ -922,7 +923,12 @@ async def _invoke_thread(
return sdk_failure(error), False


def _relay_output(output: dict[str, Any], relay: CodexRelaySettings) -> dict[str, Any]:
def _relay_output(
output: dict[str, Any],
relay: CodexRelaySettings,
*,
artifacts: list[dict[str, str]] | None = None,
) -> dict[str, Any]:
output["relay_runtime"] = {
"enabled": True,
"emitter": "codex-sdk/nemo-relay",
Expand All @@ -931,8 +937,10 @@ def _relay_output(output: dict[str, Any], relay: CodexRelaySettings) -> dict[str
"gateway_url": relay.gateway.url,
"gateway_log_path": str(relay.gateway.log_path),
}
output["relay_artifacts"] = common_utils.collect_relay_artifacts(
relay.plugin_config
output["relay_artifacts"] = (
common_utils.collect_relay_artifacts(relay.plugin_config)
if artifacts is None
else artifacts
)
return output

Expand Down Expand Up @@ -1064,18 +1072,50 @@ async def invoke(self, invocation: dict[str, Any]) -> dict[str, Any]:
"request": invocation.get("request"),
}
if self._unusable:
output = _failure(
return _failure(
"codex_runtime_unavailable",
"Codex runtime cannot accept another invocation after an SDK failure",
"Codex runtime cannot accept another invocation after a runtime failure",
)
return _relay_output(output, self._relay) if self._relay else output

try:
request_prompt(payload)
timeout_seconds(payload)
_reasoning_effort(payload)
_output_schema(payload)
relay = self._relay
atif_before = (
relay_artifacts.snapshot_atif_files(relay.plugin_config)
if relay is not None
and relay_artifacts.expects_local_atif(relay.plugin_config)
else None
)
output, usable = await _invoke_thread(payload, self._thread)
if (
output.get("completed")
and relay is not None
and atif_before is not None
):
finalized = await relay_artifacts.wait_for_finalized_atif(
relay.plugin_config, atif_before
)
if finalized is None:
self._unusable = True
return _relay_output(
adapter_failure(
AdapterRelayError(
"codex_relay_atif_timeout",
"NeMo Relay did not finalize an ATIF artifact before the deadline",
metadata={
"timeout_seconds": relay_artifacts.ATIF_FINALIZATION_TIMEOUT_SECONDS,
},
)
),
relay,
artifacts=[],
)
except AdapterRelayError as error:
output = adapter_failure(error)
usable = False
except CodexAdapterError as error:
output = adapter_failure(error)
usable = True
Expand Down
4 changes: 2 additions & 2 deletions adapters/codex/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion adapters/common/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "nemo-fabric-adapters-common"
version = "0.1.0"
version = "0.1.1"
description = "Shared Python helpers for NeMo Fabric adapters"
authors = [
{ name = "NVIDIA Corporation" },
Expand Down
Loading
Loading