Add models for Node native actions (node.hello, node.invoke_native) - #35
Merged
NeonDaniel merged 2 commits intoJul 21, 2026
Merged
Conversation
Implements the wire models from PLATFORM_NATIVE_ACTIONS.md v0.3: - NodeHello, NodeInvokeNative, NodeInvokeNativeResponse - NodeNativeAction and NativeActionErrorCode enums - NodeContext with optional MessageContext.node for the hub-stamped per-session capability snapshot
NeonDaniel
requested changes
Jul 21, 2026
NeonDaniel
left a comment
Member
There was a problem hiding this comment.
Couple nits noted, but overall looks good
- `params` enforces string keys (`Dict[str, Any]`) - `capabilities` keys are typed as `NodeNativeAction` in both `NodeHelloData` and `NodeContext` via a shared `NodeCapabilities` type, preventing re-definition of equivalent actions under new names. Unknown keys are dropped rather than rejected so a newer Node cannot invalidate `node.hello` on an older hub; keys serialize back to wire strings. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
NeonDaniel
approved these changes
Jul 21, 2026
NeonDaniel
pushed a commit
to NeonGeckoCom/neon-hana
that referenced
this pull request
Jul 28, 2026
## Summary Server side of the Node native actions spec (companion to NeonGeckoCom/neon-data-models#35, now merged and consumed here as `neon-data-models>=0.0.3a2`). - **`node.hello`**: HANA validates the message, caches the Node's identity/capability snapshot per session, and stamps it onto every outbound bus message as `context.node` — skills read capabilities synchronously with no extra round-trip. The token-derived session ID is authoritative: a mismatched self-reported `node_id` is logged and overridden, so a client cannot claim another Node's identity. Unknown capability keys are dropped at validation (a Node newer than the hub's schema must not fail its hello). - **`node.invoke_native`**: a new `handle_neon_response` override dispatches these from the MQ response queue and relays them to the target Node's WebSocket. Everything else delegates to `NeonAIClient` unchanged. The message is relayed as-is: the Node re-validates the action and reports `not_supported` itself, which reaches the skill faster than a hub-side drop would. - **`node.invoke_native.response`**: passes through the existing client-input path to the bus unchanged. - `/node/v1/doc` signature updated so the new models appear in the generated docs. ## Testing - 20 new unit tests in `tests/test_mq_websocket_api.py` (previously a TODO stub): hello caching/validation/identity, context enrichment, MQ dispatch/delegation, response passthrough. 57 pass locally. - Verified end-to-end against a live Hub running this branch: WebSocket session as a real NODE-permission user — `node.hello` with a spoofed `node_id` and an unknown capability key, `context.node` confirmed stamped (string-keyed, unknown key dropped, session identity enforced) via response context echo; `node.invoke_native` published to HANA's MQ queue arrived on the client socket; response passthrough produced no server-side errors.
NeonDaniel
pushed a commit
to NeonGeckoCom/neon-hana
that referenced
this pull request
Aug 4, 2026
Implements the HANA half of `PLATFORM_NATIVE_ACTIONS.md` v0.3 (approved
in `neon-node-design#3`). Depends on the models from
`neon-data-models#35`, merged 2026-07-21 — this pins
`neon-data-models>=0.0.3a2`, which is a published release, so there is
no git pin to unwind.
## What's here
**`node.hello` handling.** Caches per-session `capabilities` and
`node_name` before forwarding to the bus.
The payload's self-reported `data.node_id` is treated as **informational
only** — the JWT-derived session id is authoritative for identity. The
cache is never keyed from it and `context.node.node_id` is never stamped
from it. Without that rule a Node could claim another Node's identity in
its hello.
**`context.node` enrichment.** Every outbound bus message from a Node
session carries `{node_id, node_name, site_id, capabilities}`, so a
skill's `if node:` branch reads capabilities synchronously instead of
round-tripping. This also closes the Hub-side half of US-N01.
**`node.invoke_native` dispatch.** Implemented as a peek-and-delegate
override of `handle_neon_response`: peek at `msg_type`, handle
`node.invoke_native` locally, delegate everything else to iris
unchanged. That avoids duplicating iris's dispatch and timing logic; the
cost is deserializing twice, which was accepted deliberately.
The hub relays the invoke **without validating the action**. A Node-side
`not_supported` reaches the skill faster than a hub-side drop, which
would make the skill wait out its full timeout with nothing in the logs.
**`node.invoke_native.response`** flows inbound through
`handle_client_input` unchanged, with a test confirming it.
## Tests
10 new in `tests/test_mq_websocket_api.py`, covering the trust rule,
context enrichment, dispatch, and the inbound response path.
Full suite: 56 passed, 1 failed. The failure is
`tests/test_auth.py::TestClientManager::test_check_auth_request`, which
**reproduces identically on clean `dev`** — pre-existing, unrelated to
this change.
## E2E validation
Verified 2026-07-18 against a live hub (this branch running locally on
:8083, wired to the hub's real MQ, driven by a scripted Node client):
- login (`node_auth`) → WS → `node.hello` → utterance → `klat.response`
- `context.node` stamped on the bus-side utterance (spy-verified) and
echoed back on `klat.response`
- trust rule fired live: a spoofed `node_id` in the hello logged a
warning and `context.node.node_id` stayed the session identity
- `node.invoke_native` published to HANA's MQ queue → delivered over WS
to the client
- `node.invoke_native.response` → arrived on the hub bus
## Also included
`scripts/inject_invoke_native.py` publishes a `node.invoke_native`
straight to HANA's MQ queue, standing in for a skill. It made the E2E
above repeatable and stays useful afterward: it isolates the Node app
from the skill layer, so a failure while running it is unambiguously
app-side. Happy to drop it from this PR if you'd rather it not ship in
the repo.
## Notes
- Touches `MQWebsocketAPI`, which has the known pika channel leak. Not
addressed here — expect restarts while live-testing.
- Gated on `NeonGeckoCom/neon-messagebus-mq-connector#66` for the skill
path end-to-end: that whitelist currently drops `node.invoke_native`, so
a skill's emission never reaches HANA. This PR is independently
reviewable; the two together complete the hub-side path.
## Related
- `NeonGeckoCom/neon-data-models#35` (merged) — the wire models
- `NeonGeckoCom/neon-messagebus-mq-connector#66` (open) — bus → MQ
forwarding
- Node app side: `OscillateLabsLLC/neon-node-flutter-app` commits
`2cde9af`, `1509ef2`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the wire models for the Platform-Native Actions spec (PLATFORM_NATIVE_ACTIONS.md v0.3, approved in neon-node-design#3).
Changes
NodeHello— capability advertisement at WS connect. Carriesnode_id, user-editablenode_name(US-N01), and a flatcapabilitiesmap.NodeInvokeNative— Hub→Node action dispatch.paramsis an open dict; onlylaunch_sms_app/launch_email_appread it in v1 (composer pre-fill).NodeInvokeNativeResponse— Node→Hub ack. Validator enforcesstatus: errorcarries anerrorobject andstatus: successdoes not.NodeNativeAction/NativeActionErrorCodeenums — the authoritative wire strings for both sides.NodeContext+ optionalMessageContext.node— the per-session identity/capability snapshot HANA stamps on outbound bus messages (Hub-side half of US-N01).Design notes
capabilitiesisDict[str, bool], not enum-keyed: a newer Node advertising an unknown capability must not fail validation on an older hub ("absent means unsupported").actionstays a strict enum so a hub never dispatches an action it doesn't recognize.node_nameis capped at 128 chars — it rides on every outbound bus message viacontext.node, so an unbounded value would be amplified per-message.MessageContext.nodedefaults toNone; existing messages are unaffected.Testing
New tests cover validation (unknown action/error code rejected, error-state coherence), serialization round-trips,
as_messagebus_messageoutput (enums arrive as wire strings), version-skew tolerance (unknown fields/params from newer Nodes), and the wire-string golden list.