Skip to content

Feat/managed agent api commands - #102

Open
chenanran555 wants to merge 5 commits into
mainfrom
feat/managed-agent-api-commands
Open

Feat/managed agent api commands#102
chenanran555 wants to merge 5 commits into
mainfrom
feat/managed-agent-api-commands

Conversation

@chenanran555

Copy link
Copy Markdown
Contributor

Summary

Why

Type

  • New provider
  • [✅] New feature
  • Bug fix
  • Refactor
  • Documentation
  • Tests

Surface area

  • Workspace/package boundaries
  • Provider interface / adapter contract
  • YAML schema / config types
  • [✅] CLI commands
  • WebUI
  • State management
  • Execution / planning logic
  • Tests / fixtures
  • None of the above

Checklist

  • [✅] bun run verify:full passes
  • [✅] New provider follows the six-file structure, if applicable
  • [✅] No new runtime dependencies added without justification

Behavior / risk

Validation

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.
@chenanran555
chenanran555 requested a review from heimanba as a code owner August 31, 2026 10:47
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.

1 participant