Skip to content

Add ed-onde-account, an Onde account client - #21

Merged
setoelkahfi merged 2 commits into
developmentfrom
feature/ed-onde-account
Oct 10, 2026
Merged

setoelkahfi merged 2 commits into
developmentfrom
feature/ed-onde-account

Conversation

@setoelkahfi

Copy link
Copy Markdown
Collaborator

A small reqwest client for the ondeinference.com API, so MailX, Siti and ACP agents can sign a user in and get an Onde Cloud key without each reimplementing it. It holds no Onde secrets: onde-web adds the smbCloud credentials on the server.

sign_in, me, apps, create_app, activate and ensure_key. ensure_key reuses the user's app by name, activates it if it is still provisioning, and returns app_id:app_secret. Errors are typed: Unauthorized (token expired), Forbidden, InvalidCredentials, Suspended and Http. AccessToken and ApiKey are redacted in Debug.

Stacked on #20 and meant to ship with it as 1.3.0, so the version here is still the workspace's 1.2.1. The release workflow takes its publish list from the workspace members, so it needed no change.

Tested: cargo test -p ed-onde-account (8 tests against an axum mock of the API, plus the doctest), clippy with -D warnings, and fmt. I have not run it against the live site yet; that needs a test Onde account.

@sigit-code-review sigit-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds the ed-onde-account crate, a reqwest client for ondeinference.com's account API: sign_in, me, apps, create_app, activate and ensure_key, with typed errors, Debug-redacted AccessToken/ApiKey, and no Onde secrets in the host. Workspace membership, dependency entry, and README table row are updated, and an axum mock covers the client's flows. Code looks solid; the one thing worth a look is the ensure_key idempotency guarantee under concurrency.


Automated review by siGit Code Review · commit 99a95a6 · see the review dashboard

Comment thread crates/ed-onde-account/src/lib.rs Outdated
@setoelkahfi
setoelkahfi added this pull request to stack #22 October 9, 2026 19:54
@setoelkahfi setoelkahfi self-assigned this Oct 9, 2026
@setoelkahfi
setoelkahfi requested a review from paydii October 9, 2026 19:58

@paydii paydii left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change product direction, let's postpone this

@setoelkahfi
setoelkahfi removed this pull request from stack #22 October 9, 2026 23:04
@setoelkahfi
setoelkahfi changed the base branch from feature/ed-acp-local-provider to development October 9, 2026 23:05

@sigit-code-review sigit-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduces the new ed-onde-account crate, a client for the ondeinference.com API that allows agents to sign in users, manage their Onde apps, and obtain Onde Cloud API keys without embedding Onde secrets. The implementation provides typed error handling, redacts sensitive values in debug output, and includes a robust, idempotent ensure_key method that avoids creating duplicate apps even under concurrent calls. The crate is tested with an in-process Axum mock server, and the workspace and documentation are updated to include it. The ed-acp crate is also updated to support on-device inference with onde via a new local feature, including CLI integration and model selection logic. The previous warning about non-atomic app creation in ensure_key is now addressed: the implementation converges on a single app even if concurrent creates occur, and does not violate the "never creates a second app" guarantee, though extra apps may remain unused. No critical or new correctness issues are present in the diff.


Automated review by siGit Code Review · commit cf19b7d · see the review dashboard

@paydii

paydii commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Let's go with this.

@keypair34
keypair34 self-requested a review October 10, 2026 05:21

@keypair34 keypair34 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the local inference changes from this PR.

Comment thread crates/ed-acp/src/cli.rs
Comment thread crates/ed-acp/src/cli.rs
@keypair34
keypair34 requested a review from paydii October 10, 2026 05:32
@paydii

paydii commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Remove the local inference changes from this PR.

We could merge #20 first and test it on the smbCloud Mail app that only has on-device inference.

setoelkahfi and others added 2 commits October 10, 2026 12:29
Signs a user in through the ondeinference.com API, finds or creates their
app, activates it and returns the Onde Cloud key. ensure_key reuses an app
by name, so calling it twice never makes a second one. The crate holds no
Onde secrets: the API adds the smbCloud credentials on the server.

Covered by tests against an in-process mock of the API.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: siGit Code v1.6.6 <noreply@sigit.si>
After creating an app, ensure_key lists again and picks the oldest
active-or-provisioning app with that name, so two concurrent first
calls return the same key. The doc comment now says what holds: the
extra app can still exist, since the client has no delete call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: siGit Code v1.6.3 <noreply@sigit.si>
@setoelkahfi
setoelkahfi force-pushed the feature/ed-onde-account branch from cf19b7d to ba341cf Compare October 10, 2026 10:37
@setoelkahfi

Copy link
Copy Markdown
Collaborator Author

@keypair34 Done — the local-inference changes are no longer part of this PR.

They were already merged into development independently via #20 (feature/ed-acp-local-provider). This branch had them only because it forked before #20 landed, which was also the cause of the merge conflict.

I rebased feature/ed-onde-account onto development. After the rebase, this PR's diff against development is purely additive — only the new ed-onde-account crate plus its Cargo.toml/Cargo.lock/README wiring:

 Cargo.lock                            |  12 +
 Cargo.toml                            |   2 +
 README.md                             |   1 +
 crates/ed-onde-account/Cargo.toml     |  22 +
 crates/ed-onde-account/LICENSE-APACHE | 202 +++
 crates/ed-onde-account/LICENSE-MIT    |  21 +
 crates/ed-onde-account/README.md      |  35 +
 crates/ed-onde-account/src/lib.rs     | 413 +++
 crates/ed-onde-account/tests/api.rs   | 267 +++
 9 files changed, 975 insertions(+)

No ed-acp/src/cli.rs / Provider::Local changes remain in the diff — they now come from the base. The onde 1.3.2 comment commit became empty after the rebase (that change is already on development) and was dropped.

New head is ba341cf. CI gate re-run locally and green: cargo fmt -- --check, cargo clippy --tests -- -D warnings, cargo test --locked all pass. Merge conflict is also resolved (MERGEABLE). PTAL.

@sigit-code-review sigit-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change introduces the new ed-onde-account crate, a client for the ondeinference.com API that enables agents to sign in users, manage their Onde apps, and retrieve Onde Cloud API keys without embedding Onde secrets. The crate is added to the workspace and documented in the root README. The implementation includes typed error handling, redacted debug output for sensitive types, and an idempotent ensure_key method that avoids duplicate app creation even under concurrent calls. The test suite uses an axum mock server to cover all major flows and edge cases, including races and error handling. Previous review findings about atomicity and races in ensure_key were addressed by re-listing apps after creation and updating the documentation and tests accordingly. No new unresolved issues from earlier reviews remain.


Automated review by siGit Code Review · commit ba341cf · see the review dashboard

@keypair34 keypair34 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@setoelkahfi
setoelkahfi merged commit 5d84ab0 into development Oct 10, 2026
1 check passed
@setoelkahfi
setoelkahfi deleted the feature/ed-onde-account branch October 10, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants