Feat/managed agent api commands - #102
Open
chenanran555 wants to merge 5 commits into
Open
Conversation
Command hosts could only reach Managed Agents through the declarative project workflows, so per-resource reads, cursor pagination, raw session events and deployment actions had no public entry point. - Add internal/core/managed-api-runtime.ts: cursor-preserving reads for agents, agent versions, environments, vaults, skills (list/get/versions/ download) and files, plus session update/archive/raw-event-send and deployment get/run/pause/unpause with run history. - Resolve the target provider from ManagedApiTarget and fail fast with a UserError when several providers are configured or the adapter lacks the operation; publish per-operation capability metadata (supported/auth/ reason) so hosts can explain unsupported surfaces (model catalog, Thread resources, MCP OAuth) without probing the API. - Extend ProviderAdapter with the matching optional methods and implement them on the Bailian adapter; keep the raw wire payload on `attributes` for agent/environment/vault/skill/file DTOs. - Support `types` and `created_at[*]` filters on event listing plus status/created-at filters on session listing, with client-side type filtering where the server has no support. - Resume streamSessionEvents from `after_id` on providers without native stream cursors by replaying paginated history and polling, de-duping by event id and stopping on terminal session status. - Carry `session_thread_id` through the Bailian event mapper and the event sanitizer so child-agent threads stay attributable. - Document the new public layers and add a minor changeset. Tests: packages/sdk/tests/unit/bailian-managed-api.test.ts (new) and core-session-runtime.test.ts (client-side type filter, after-id replay).
The preceding SDK commit added an optional `attributes` field to the CloudAgent/CloudEnvironment/CloudVault zod schemas. The server routes reuse those schemas verbatim, so the runtime OpenAPI document drifted from the committed snapshot, and the webui's generated wire types drifted from it in turn. Regenerated both artifacts with their own scripts, no hand edits: - bun run --cwd apps/server gen:openapi - bun run --cwd apps/webui gen:api-types The whole diff is the optional `attributes` object on the item schemas of GET /api/cloud-agents, /api/cloud-environments and /api/cloud-vaults, which are already raw cloud-resource passthroughs — no request or response behavior changes. Unblocks the openapi-contract and api-types-freshness snapshot tests that failed verify:push.
Add address-scoped planning, refresh, and execution for Agent resources. Require the target Agent to be newly created and all dependencies to be reconciled, while keeping display names independent from YAML keys.
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.
Summary
Why
Type
Surface area
Checklist
bun run verify:fullpassesBehavior / risk
Validation