Repository navigation
Description
✅ As merged on main — DONE (PR #213 · released in ts-client v1.26.0, npm latest)
src/models/agent-profile.ts—AgentProfileunion (OpenHandsAgentProfilew/llm_profile_ref;ACPAgentProfilew/acp_*and nollm_profile_ref/credential), both carryingmcp_server_refs: string[] | null;AgentProfileSummary;AgentProfileDiagnostics(mirrors the Pythonresolver.AgentProfileDiagnosticsfield-for-field).src/client/agent-profiles-client.ts—AgentProfilesClient(list/get/save/delete/rename/activateby id/materializeby name), surfacing 409/422 viaHttpError.src/profiles/derive-switch-plan.ts— purederiveSwitchPlan(unit-tested across providers).- ACP credential descriptor (
api_key_env_var/base_url_env_var/file_secrets) onACPProviderInfofor all three providers (claude-code / codex / gemini-cli). agent_profile_idon the create-conversation path +launched_profileonConversationInfoare typed and present onmain.
src/models/acp.ts (not src/utils/acp.ts — the file was relocated utils/→models/ in earlier work #210). The provenance type shipped as LaunchedAgentProfile { agent_profile_id, revision } (named launched_profile on ConversationInfo) — the { id, revision, snapshot } shape below was superseded (no snapshot member). Publishing is tag-driven, so the committed package.json version is set at publish time. All acceptance criteria met.
Original spec (delivered as above; acp.ts path + LaunchedProfile/snapshot superseded by the corrections)
Phase 3 — typescript-client · typescript-client · size M · Parent epic #3713
Depends on: [agent-server] /api/agent-profiles router + provenance (#3719, #3720)
ts-client is a small, hand-written repo (no codegen). Work is purely additive. Split into 2 PRs only if the diff gets unwieldy.
Context
The client is a thin, hand-written wrapper (no codegen). Hard ordering: author only after the SDK schema + routers are frozen. No MCPProfilesClient is needed — mcp_server_refs is a plain string[] | null field. The ACP provider credential metadata (api_key_env_var, base_url_env_var, file_secrets) is static and goes directly into src/utils/acp.ts (actual: src/models/acp.ts) — no API call needed.
Scope
1. AgentProfile union + client
AgentProfilediscriminated union (onagent_kind) insrc/models/agent-profile.ts:- OpenHands variant:
{ id, name, revision, llm_profile_ref: string, mcp_server_refs: string[] | null, agent, skills, system_message_suffix, condenser, verification, enable_sub_agents, tool_concurrency_limit } - ACP variant:
{ id, name, revision, acp_server, acp_model, acp_session_mode, acp_prompt_timeout, acp_command, acp_args, mcp_server_refs: string[] | null }— nollm_profile_ref, no credential field AgentProfileSummaryfor lists.
- OpenHands variant:
src/client/agent-profiles-client.tsover/api/agent-profiles(list/get/save/delete/rename/activate/materialize), surfacing409-on-referenced +422-dangling-mcp-server-ref errors viaHttpErrorstatus.- Typed
agent_profile_idon the conversation-create path (CreateConversationPayloadisRecord<string, unknown>today — additive, no break).
2. ACP provider descriptor extension
- Extend
ACPProviderInfoinsrc/utils/acp.ts(actual:src/models/acp.ts) with:api_key_env_var?: string,base_url_env_var?: string,file_secrets?: { secret_name: string; filename: string; env_var: string }[]. Populate for each existing provider (claude-code, codex, gemini). This is static metadata — no API call needed, no server endpoint. The canvas ACP authentication section ([AgentProfile][canvas] Provider-driven ACP Authentication section (creds out of the generic Secrets panel) #3728) reads these fields to render the credential form.
3. Resolve/materialize types + deriveSwitchPlan
- Type the materialize response (resolved
AgentSettingsConfigunion + ref resolved/dangling status + valid verdict) and theLaunchedProfile { id, revision, snapshot }provenance (actual:LaunchedAgentProfile { agent_profile_id, revision }). - Pure
deriveSwitchPlan(snapshot, targetProfile, providerInfo) → current | switch-live(mutableFields) | start-new(reason) | disabled(reason), consumingACPProviderInfo.supports_runtime_model_switch+ the existingswitchProfile/switchLLM/switchAcpModelmethods (conversation-client.ts:262–283). OpenHands→OpenHands live only if just the LLM differs; ACP→ACP live only if same provider + identity and onlyacp_modeldiffers and the provider supports it; kind change never live.
Wiring/publish: dedicated clients only. Wire into ConversationManager, export from src/clients.ts + src/index.ts, add api-clients.test.ts coverage. Publishing is tag-driven; canvas re-pins via the usual temp-SHA dance.
Acceptance criteria
- Exported types match the SDK schemas field-for-field; union narrows on
agent_kind(both variants havemcp_server_refs: string[] | null). ACPProviderInfohas credential metadata fields for all three providers; no hardcoded provider lists in canvas.- FK error statuses surfaced;
deriveSwitchPlanis pure + unit-tested across all ACP providers + OpenHands. tscclean; new clients tested.
Activity
[-][AgentProfile][ts-client] MCPConfig + MCPProfile types + MCPProfilesClient[/-][+][AgentProfile][ts-client] Profile types + clients (MCPProfile, AgentProfile, resolve/materialize) + deriveSwitchPlan[/+][-][AgentProfile][ts-client] Profile types + clients (MCPProfile, AgentProfile, resolve/materialize) + deriveSwitchPlan[/-][+][AgentProfile][ts-client] AgentProfile types + client + resolve/materialize types + deriveSwitchPlan[/+]simonrosenberg commentedon Jun 17, 2026
Status — part 2 of 3 done (issue stays open)
Part 2 · ACP provider descriptor extension — done via OpenHands/typescript-client#210 (merged).
Note on scope: the credential descriptor fields this part asked to add (
api_key_env_var,base_url_env_var,file_secrets) were already present onACPProviderInfo— they landed earlier with the registry-mirror PRs typescript-client#173 / #187 / #205, which post-date this issue's text (and the registry moved fromsrc/utils/acp.ts→src/models/acp.ts). So #210's actual contribution was:src/__tests__/acp-providers.test.ts) locking the credential metadata in for all three providers +getAcpProvideredge cases (the "add a brief unit test" ask), andsupports_set_session_modelfalse → true— which fixed thevalidate-acp-providersdrift check that was red onmain(SDK flipped it in ACP claude-code initial model selection via session _meta is silently ignored by claude-agent-acp 0.30.0 #3654).Acceptance criterion "
ACPProviderInfohas credential metadata fields for all three providers" is therefore satisfied onmain.Still outstanding:
AgentProfilediscriminated union (src/models/agent-profile.ts) +AgentProfilesClientover/api/agent-profiles+ typedagent_profile_idon conversation-create. (Prior attempt typescript-client#195 was closed unmerged.)deriveSwitchPlan— typed materialize response (resolvedAgentSettingsConfigunion +LaunchedProfileprovenance) and the purederiveSwitchPlan(snapshot, targetProfile, providerInfo).Leaving this open to track parts 1 & 3.
simonrosenberg commentedon Jun 18, 2026
Resolved by typescript-client PR #213 (merged 2026-06-18) — AgentProfile model + client (CRUD/activate/materialize),
AgentProfileDiagnosticstypes,agent_profile_id+LaunchedProfileon conversation, and purederiveSwitchPlan. Phase 3 complete. Note: #213 is on ts-client main but not yet in a release (latest v1.25.0) — a ts-client release must be cut before canvas (#3726) can consume it.simonrosenberg commentedon Jun 21, 2026
Audit note (2026-06-21) — closed + correct, released in ts-client v1.26.0 (npm
latest). PR #213 fully implements this:AgentProfiletypes (src/models/agent-profile.ts),AgentProfilesClient(src/client/agent-profiles-client.ts), and a purederiveSwitchPlan(src/profiles/derive-switch-plan.ts). Containment re-verified:git show v1.26.0:…confirms all three present.Two doc-only clarifications (no code change): the ACP credential descriptor lives in
src/models/acp.ts, notsrc/utils/acp.tsas the body says (the file was relocatedutils/→models/in earlier work #210); and theagent_profile_id/launched_profileConversationInfotypes are already present on main — only their server-side runtime activation was gated on SDK #3784.