feat: add MetaProfilesClient and meta-profile types#212
Conversation
Adds first-class support for the agent-server `/api/meta-profiles` endpoints (introduced in software-agent-sdk PR #3744) so consumers no longer have to redefine the request/response shapes or drive the raw HttpClient themselves. - models/api.ts: add MetaProfile, MetaProfileClass, MetaProfileInfo and the list/detail/mutation/activate response interfaces. - client/meta-profiles-client.ts: new MetaProfilesClient mirroring ProfilesClient (list/get/save/delete/activate). Meta-profiles carry no secrets, so there is no X-Expose-Secrets handling. - conversation-manager.ts: expose `metaProfiles` namespace and close it. - clients.ts / index.ts: export the client, its options and the new types. - tests: cover all five MetaProfilesClient methods (endpoint, verb, percent-encoding, body) and assert the manager wires the namespace. Co-authored-by: openhands <openhands@all-hands.dev>
|
✅ Review complete. This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here. |
all-hands-bot
left a comment
There was a problem hiding this comment.
🟢 Good taste — Elegant, minimal addition that follows established patterns exactly.
This PR adds MetaProfilesClient as a first-class citizen of the TypeScript client. The implementation is a clean mirror of ProfilesClient, the types are well-structured, all five CRUD+activate methods are tested, and the wiring into ConversationManager (construction + close()) is correct. No issues found.
A few observations worth noting for awareness (none blocking):
MetaProfileMutationResponseandActivateMetaProfileResponseare structurally identical{ name: string; message: string }. This is consistent with howProfileMutationResponseandActivateProfileResponseare handled and is a deliberate semantic distinction — fine as-is.saveMetaProfiletakesconfig: MetaProfiledirectly (no wrapper type), which correctly reflects that meta-profiles carry no secrets and need noinclude_secretsflag, unlikeSaveProfileRequestfor LLM profiles.- The test for
activateMetaProfilecorrectly verifies the'{}'body, matching the same pattern used byProfilesClient.activateProfile.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟢 LOW
Pure additive change — new exports, new client class, new types, new tests. No existing interfaces or behaviour are modified. Risk is minimal.
VERDICT:
✅ Worth merging: Core logic is sound, pattern is consistent, tests cover all methods.
KEY INSIGHT:
Strict adherence to the ProfilesClient pattern keeps the surface area of this PR minimal and the cognitive overhead for future maintainers near zero.
This review was generated by an AI agent (OpenHands) on behalf of the user through OpenHands Automation. View conversation
Summary
Adds first-class support for the agent-server
/api/meta-profilesendpoints (introduced in software-agent-sdk #3744) to the TypeScript client.A meta-profile is a declarative model-routing configuration consumed by the
classify_and_switch_llmtool: it names aclassifier_model, adefault_model, and a list of taskclasses, where every model reference is the name of a saved LLM profile.Until now, consumers (e.g. agent-canvas) had to redefine these request/response interfaces locally and drive the raw
HttpClientthemselves. This PR moves the shapes into the shared client so they can be imported directly — the same pattern asProfilesClient.Changes
models/api.ts— addMetaProfile,MetaProfileClass,MetaProfileInfo, and theMetaProfileListResponse/MetaProfileDetailResponse/MetaProfileMutationResponse/ActivateMetaProfileResponseinterfaces.client/meta-profiles-client.ts— newMetaProfilesClientmirroringProfilesClient(listMetaProfiles/getMetaProfile/saveMetaProfile/deleteMetaProfile/activateMetaProfile). Meta-profiles carry no secrets, so there is noX-Expose-Secretshandling.conversation/conversation-manager.ts— expose ametaProfilesnamespace and close it alongside the other clients.clients.ts/index.ts— export the client, its options type, and the new API types.MetaProfilesClientmethod (endpoint, HTTP verb, percent-encoding, request body) plus aConversationManagerwiring assertion.Verification
npm run build✅npm run lint✅ (0 errors; pre-existing warnings only)npm run format:check✅npm test✅ — 229/229 unit tests pass (the onetest-utilsfailure only occurs whenAGENT_SERVER_URLis set in the shell; it passes in a clean env and is unrelated to this change)Follow-up
Once released, agent-canvas (PR #1395) will drop its locally-defined interfaces and import them from here, mirroring
ProfilesService.This PR was created by an AI agent (OpenHands) on behalf of the user.