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 .github/workflows/canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install bridge + test deps
run: |
uv pip install --system \
"inkbox==0.7.29" \
"inkbox @ git+https://github.com/inkbox-ai/inkbox.git@84386f5ea022a9594fb901894f927ee444c2cf91#subdirectory=sdk/python" \
-e . pytest

- name: Install pinned Codex
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/live-a2a.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
mkdir -p "$RUNNER_TEMP/codex-home" "$RUNNER_TEMP/project"

- name: Install bridge and protocol driver
run: pip install "inkbox==0.7.29" -e .
run: pip install "inkbox @ git+https://github.com/inkbox-ai/inkbox.git@84386f5ea022a9594fb901894f927ee444c2cf91#subdirectory=sdk/python" -e .

- name: Install Codex
run: bash "$GITHUB_WORKSPACE/tests/ci/install_codex.sh"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/live-channels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
- name: Install bridge + test deps
run: |
uv pip install --system \
"inkbox==0.7.29" \
"inkbox @ git+https://github.com/inkbox-ai/inkbox.git@84386f5ea022a9594fb901894f927ee444c2cf91#subdirectory=sdk/python" \
-e . pytest

- name: Install pinned Codex
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/live-external-events.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Install bridge + test deps
run: |
uv pip install --system \
"inkbox==0.7.29" \
"inkbox @ git+https://github.com/inkbox-ai/inkbox.git@84386f5ea022a9594fb901894f927ee444c2cf91#subdirectory=sdk/python" \
-e . pytest

- name: Install pinned Codex
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/live-voice.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
- name: Install bridge + test deps
run: |
uv pip install --system \
"inkbox==0.7.29" \
"inkbox @ git+https://github.com/inkbox-ai/inkbox.git@84386f5ea022a9594fb901894f927ee444c2cf91#subdirectory=sdk/python" \
-e . pytest fastapi 'uvicorn[standard]'

- name: Install pinned Codex
Expand Down
47 changes: 24 additions & 23 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ jobs:

# Live helper regressions exercise the SDK's real pagination offline.
- name: Install test deps
run: uv pip install --system -e . pytest httpx aiohttp segno "croniter>=6.2,<7" "tzdata>=2025.1" "inkbox==0.7.29" "audioop-lts>=0.2.1; python_version >= '3.13'"
run: uv pip install --system -e . pytest httpx aiohttp segno "croniter>=6.2,<7" "tzdata>=2025.1" "inkbox @ git+https://github.com/inkbox-ai/inkbox.git@84386f5ea022a9594fb901894f927ee444c2cf91#subdirectory=sdk/python" "audioop-lts>=0.2.1; python_version >= '3.13'"

- name: Verify released SDK in MCP interpreter
- name: Verify pinned SDK in MCP interpreter
run: python tests/ci/assert_released_sdk.py

- name: Run unit tests
run: pytest -q

# Exercise Slack request and response contracts against the released SDK floor.
# Exercise Slack request and response contracts against the pinned SDK floor.
slack-sdk:
runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 10
Expand All @@ -51,10 +51,10 @@ jobs:
with:
python-version: "3.12"
- uses: astral-sh/setup-uv@v8.1.0
- name: Install bridge and released SDK
- name: Install bridge and pinned SDK
run: >-
uv pip install --system -e . pytest httpx "inkbox==0.7.29"
- name: Verify released SDK in MCP interpreter
uv pip install --system -e . pytest httpx "inkbox @ git+https://github.com/inkbox-ai/inkbox.git@84386f5ea022a9594fb901894f927ee444c2cf91#subdirectory=sdk/python"
- name: Verify pinned SDK in MCP interpreter
run: python tests/ci/assert_released_sdk.py

- name: Require provisioning-workspace and identity-subscription support
Expand All @@ -79,7 +79,7 @@ jobs:
tests/test_slack_attachments.py tests/test_slack_inbound_files.py tests/test_slack_progress.py tests/test_slack_streams.py
tests/test_tools.py::test_coding_agent_tool_tier_is_registered

# Exercise optional native replies against the shared released SDK floor.
# Exercise optional native replies against the shared pinned SDK floor.
imessage-sdk:
runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 10
Expand All @@ -88,11 +88,12 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install bridge and released native-reply SDK
- uses: astral-sh/setup-uv@v8.1.0
- name: Install bridge and pinned native-reply SDK
run: >-
pip install -e . pytest httpx
"inkbox==0.7.29"
- name: Verify released SDK in MCP interpreter
uv pip install --system -e . pytest httpx
"inkbox @ git+https://github.com/inkbox-ai/inkbox.git@84386f5ea022a9594fb901894f927ee444c2cf91#subdirectory=sdk/python"
- name: Verify pinned SDK in MCP interpreter
run: python tests/ci/assert_released_sdk.py

- name: Require native reply support
Expand All @@ -109,7 +110,7 @@ jobs:
tests/test_imessage_state.py tests/test_imessage_gateway.py
tests/test_imessage_sdk.py tests/test_companion.py

# Exercise Slack initialization against the same released SDK floor.
# Exercise Slack initialization against the same pinned SDK floor.
slack-companion-sdk:
runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 15
Expand All @@ -122,11 +123,11 @@ jobs:
with:
node-version: "22"
- uses: astral-sh/setup-uv@v8.1.0
- name: Install bridge and released Slack-aware SDK
- name: Install bridge and pinned Slack-aware SDK
run: >-
uv pip install --system -e . pytest httpx
"inkbox==0.7.29"
- name: Verify released SDK in MCP interpreter
uv pip install --system -e . pytest httpx "inkbox @ git+https://github.com/inkbox-ai/inkbox.git@84386f5ea022a9594fb901894f927ee444c2cf91#subdirectory=sdk/python"
"inkbox @ git+https://github.com/inkbox-ai/inkbox.git@84386f5ea022a9594fb901894f927ee444c2cf91#subdirectory=sdk/python"
- name: Verify pinned SDK in MCP interpreter
run: python tests/ci/assert_released_sdk.py

- name: Require Slack initialization support (do not silently skip)
Expand Down Expand Up @@ -163,19 +164,19 @@ jobs:
- name: Install bridge + test deps
run: |
uv pip install --system \
"inkbox==0.7.29" \
"inkbox @ git+https://github.com/inkbox-ai/inkbox.git@84386f5ea022a9594fb901894f927ee444c2cf91#subdirectory=sdk/python" \
-e . pytest

- name: Install pinned Codex
run: bash "$GITHUB_WORKSPACE/tests/ci/install_codex.sh"

- name: Verify released SDK in MCP interpreter
- name: Verify pinned SDK in MCP interpreter
run: python tests/ci/assert_released_sdk.py

- name: Contract tests vs real Codex
run: pytest tests/contract -v

# Exercise complete Companion initialization with the released SDK and real
# Exercise complete Companion initialization with the pinned SDK and real
# host, using the same supported SDK floor as the other verification lanes.
companion-sdk:
runs-on: blacksmith-2vcpu-ubuntu-2404
Expand All @@ -189,11 +190,11 @@ jobs:
with:
node-version: "22"
- uses: astral-sh/setup-uv@v8.1.0
- name: Install released SDK and test dependencies
- name: Install pinned SDK and test dependencies
run: >-
uv pip install --system -e . pytest httpx
"inkbox==0.7.29"
- name: Verify released SDK in MCP interpreter
uv pip install --system -e . pytest httpx "inkbox @ git+https://github.com/inkbox-ai/inkbox.git@84386f5ea022a9594fb901894f927ee444c2cf91#subdirectory=sdk/python"
"inkbox @ git+https://github.com/inkbox-ai/inkbox.git@84386f5ea022a9594fb901894f927ee444c2cf91#subdirectory=sdk/python"
- name: Verify pinned SDK in MCP interpreter
run: python tests/ci/assert_released_sdk.py

- name: Verify helper is present (do not silently skip its tests)
Expand Down
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# Changelog

## 0.2.42

- Retain managed inbound work when final reply delivery cannot be confirmed.

## 0.2.41

### Changed
- Require Inkbox SDK 0.7.39 for durable messaging and remote tool handling.

## 0.2.40

- Make managed diagnostics use a recent runtime health report instead of terminal signing-key or ordinary webhook settings. Keep standalone checks and report unavailable runtime evidence.

## 0.2.39

- Accept empty MCP continuation input requests through the pinned SDK revision.

- Keep contact and terminal-reply MCP arguments within the advertised schema while retaining durable operation identity and retry receipts.

## 0.2.38

- Retry incomplete live-test call cleanup and verify calls have ended between tests.

## 0.2.37

- Deduplicate incoming message and call-completion retries by event ID even when each delivery has a new request ID.
- Ignore the standard Inkbox email footer when handling approval and cancellation replies.

## 0.2.36

- Reuse valid tunnel certificates across reconnects and renew mismatched or expired state with Inkbox SDK 0.7.38 or newer.
- Bound tunnel startup and reconcile cancelled attempts before reconnecting, including late listener cleanup.

## 0.2.35

- Report durable managed message and chat completion timestamps so supervisors can count inactivity after work finishes. Status reads do not extend the idle window.
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1154,3 +1154,17 @@ Use a compatible SDK with WhatsApp Companion channel and sender-access support.
### Externally registered schedules

When timing is managed externally, saving a job is a local intent, not confirmation that it is scheduled or has executed. Read `registration_status` in the schedule result: `pending` means registration is still waiting, `registered` confirms acceptance, and `rejected` includes an actionable `registration_error`. A rejected revision is acknowledged once and does not retry indefinitely. Edit the same job to correct it; do not silently change the requested cadence. Execution is confirmed separately in schedule history.

See [Remote Inkbox tools](REMOTE_TOOLS.md) for discovery, permissions, retained local capabilities and retry behavior.

### Managed diagnostics

When `INKBOX_HOSTED_MODE=1`, doctor reads the secret-free report named by
`INKBOX_DIAGNOSTICS_FILE`. Reports must match the identity and harness, belong to
this user, have private file permissions, and be no more than 60 seconds old.
Missing, stale, or unhealthy reports do not establish readiness. With
`INKBOX_DIAGNOSTIC_CONTEXT=terminal`, the signing key is checked in the runtime
report; the key itself is not needed in the terminal. Runtime processes still
require their own signing key. Managed delivery does not require ordinary webhook
subscriptions. Standalone diagnostics are unchanged. These checks do not send
messages or prove end-to-end delivery.
50 changes: 50 additions & 0 deletions REMOTE_TOOLS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Remote Inkbox tools

Claimed identity credentials discover tools from the current Inkbox MCP catalog.
The complete input/output schemas, annotations and structured results travel with
the catalog. New remote tools do not require a plugin release. Calls use the
native session, turn and call identity, retain a durable continuation before
execution, and recheck current authorization when retrying. An expired uncertain
operation is not converted into a new send.

Admin and unclaimed credentials retain their supported local setup and tools.
An unknown credential type or failed authority check cannot authorize remote tools.
Existing configuration, unrelated tool connections and conversation history remain
in place.

## Capability ownership

| Capability | Owner and preserved behavior |
| --- | --- |
| Current catalog, including mail, conversations, contacts, notes, calls and available channel operations | Remote MCP; full schema validation and current identity authority. |
| Legacy contact lookup/list/get/create/update/delete names | Compatibility names delegated to the matching remote tool, including labeled addresses and stable mutation identity. |
| Channel send/reply helpers | Local delivery plumbing retains local-file staging, channel formatting, native source checks and delivery receipts. Canonical remote sends remain available for ordinary tool use. |
| Historical list/read helpers without an equivalent schema | Retained for their existing date filters, raw message access, conversation selectors or transcript behavior. They do not define the remote catalog. |
| Voice sessions and live-call controls | Local transport and host callbacks remain responsible for voice connections and native execution. |
| A2A callbacks and delegation | Local task context, progress, cancellation and caller routing remain responsible for delivery. Remote catalog tools are also available where supported. |
| Local secrets, local scheduling and media | Existing host/plugin implementations remain local. Remote discovery never moves local keys or files to a model-visible catalog. |

`inkbox_reply_current` declares a terminal text reply to the admitted email or SMS
message. Its destination comes from the original message; it accepts no destination
argument. Accepted or submitted-but-unconfirmed replies suppress the automatic
final text for that source. Progress and unrelated sends do not suppress it. An
uncertain helper call must be reconciled with the same text and operation; a
pre-execution rejection still allows a later reply. Other channel-specific reply
helpers retain their existing receipts and delivery behavior.

Call histories live under the plugin's private state directory, scoped to origin,
identity and session. Each session has a bounded history. Retire its history only
when the native session and any outstanding delivery have been retired; deleting
history for an active session discards retry identity.

## Codex behavior

The native stdio connection preserves tool-call metadata and structured results.
Gateway sessions refresh the catalog at an idle turn boundary after five minutes,
reconnecting the same native conversation. Standalone connections refresh when
Codex reconnects the MCP server. Native browser Ask sessions enforce approval for
all configured MCP servers without rewriting their saved connection settings;
explicit YOLO sessions retain their selected native policy. The native contract
suite qualifies Codex 0.163.0. Older hosts without stable metadata cannot execute
remote calls. `inkbox_get_email` and `inkbox_get_call` also delegate to their remote
read equivalents. Vault decryption/TOTP and durable schedules remain local.
2 changes: 1 addition & 1 deletion inkbox_codex/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Inkbox bridge for Codex — email, SMS, iMessage, and voice."""

__version__ = "0.2.35"
__version__ = "0.2.42"
5 changes: 5 additions & 0 deletions inkbox_codex/chat_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ async def request(method, params):

if not is_approval(params):
raise ValueError("Unsupported MCP input form")
options = spec.get("options") or {}
if (options.get("approval_policy") == "never"
and options.get("sandbox") == "danger-full-access"
and spec["session_id"] not in self.cancelled):
return elicitation_response(params, "allow")
result = await ask(
{
"kind": "approval",
Expand Down
32 changes: 32 additions & 0 deletions inkbox_codex/codex_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def __init__(
process_env: Optional[Dict[str, str]] = None,
process_started: Optional[Callable[[int], None]] = None,
turn_started: Optional[TurnStartedHandler] = None,
force_tool_approval: bool = False,
) -> None:
self.observation_id = uuid.uuid4().hex
self.cfg = cfg
Expand All @@ -196,6 +197,7 @@ def __init__(
self._process_env = process_env
self._process_started = process_started
self.turn_started = turn_started
self.force_tool_approval = force_tool_approval
self._isolated_process_group = isolate_process_group and os.name == "posix"
self._owns_process_group = os.name == "posix"
self._process_group_id: Optional[int] = None
Expand Down Expand Up @@ -257,6 +259,36 @@ async def connect(self, resume_thread_id: Optional[str] = None) -> str:
await self._initialize()

params = self._thread_params()
if self.force_tool_approval:
saved = await self._request("config/read", {
"includeLayers": False, "cwd": self.cfg.project_dir or None,
})
servers = (saved.get("config") or {}).get("mcp_servers") or {}
if not isinstance(servers, dict) or len(servers) > 128:
raise CodexAppServerError("Native MCP approval configuration is unavailable")
config = params.setdefault("config", {})
if config is None:
config = params["config"] = {}
for name in ("inkbox", "inkbox_connected"):
supplied = config.pop(f"mcp_servers.{name}", None)
if supplied is not None:
servers[name] = {**servers.get(name, {}), **supplied}
overrides = {}
for name, server in servers.items():
if not isinstance(name, str) or not isinstance(server, dict):
raise CodexAppServerError("Native MCP approval configuration is invalid")
tools = server.get("tools") or {}
if not isinstance(tools, dict) or len(tools) > 4096:
raise CodexAppServerError("Native MCP approval configuration exceeds its limits")
if any(not isinstance(settings, dict) for settings in tools.values()):
raise CodexAppServerError("Native MCP tool approval configuration is invalid")
overrides[name] = {
**{key: value for key, value in server.items() if value is not None},
"default_tools_approval_mode": "prompt",
"tools": {tool: {**settings, "approval_mode": "prompt"}
for tool, settings in tools.items()},
}
config["mcp_servers"] = overrides
if resume_thread_id:
params["threadId"] = resume_thread_id
result = await self._request("thread/resume", params)
Expand Down
10 changes: 10 additions & 0 deletions inkbox_codex/doctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
from schedule_tools import schedule_status, schedule_status_detail


try:
from .hosted_diagnostics import hosted_diagnostics
except ImportError:
from hosted_diagnostics import hosted_diagnostics


def run_doctor() -> List[Tuple[str, bool, str]]:
"""Run every readiness check.

Expand All @@ -35,6 +41,10 @@ def run_doctor() -> List[Tuple[str, bool, str]]:
_maybe_load_env_file()

cfg = read_config()
hosted = hosted_diagnostics(cfg.identity, "codex", cfg.signing_key)
if hosted is not None:
return hosted["checks"]

checks: List[Tuple[str, bool, str]] = []

checks.append(("INKBOX_API_KEY", bool(cfg.api_key), "set" if cfg.api_key else "missing"))
Expand Down
Loading
Loading