Skip to content

Commit 8b0718d

Browse files
committed
feat(sdk): expose Managed Agents operation-level APIs
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).
1 parent 982704f commit 8b0718d

20 files changed

Lines changed: 1330 additions & 29 deletions

.changeset/calm-otters-list.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@openagentpack/sdk": minor
3+
---
4+
5+
Expose Bailian Managed Agents operation-level reads, cursor pagination, session events, file downloads, deployment actions, and provider capability metadata.

packages/sdk/docs/public-api-layers.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,17 @@ The public entry exposes domain workflows that return structured domain results.
1818
New CLI and WebUI behavior should start here.
1919

2020
- Project/resource workflows: config resolution, planning, apply, and destroy.
21-
- Agent workflows: agent listing, readiness, resource planning, and sync.
22-
- Session workflows: creation, runs, follow-up messages, event listing, and
23-
summaries.
24-
- Deployment workflows: listing, details, and runs.
21+
- Agent workflows: agent listing/detail/version reads, readiness, resource
22+
planning, and sync.
23+
- Managed-resource reads: environment, skill/version/download, vault, and file
24+
metadata/content APIs with opaque cursor preservation.
25+
- Session workflows: creation, list/get/update/archive/delete, runs, follow-up
26+
messages, raw event send/list/stream, and summaries. Managed Agents child
27+
threads remain event metadata (`session_thread_id`); there is no independent
28+
public Thread resource API.
29+
- Deployment workflows: list/get/search, run history, run, pause, and unpause.
30+
- Operation capabilities: provider-scoped support/auth/reason metadata for
31+
API-oriented command hosts.
2532
- State workflows: a file/in-memory `StateManager` plus state-address parsing.
2633
- Validation/model workflows: config validation and provider/model discovery.
2734

packages/sdk/src/index.ts

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,68 @@ export {
7979
runDeploymentForContext,
8080
} from "./internal/core/deployment-runtime.ts";
8181

82-
export type { DeploymentListFilter, DeploymentListResult } from "./internal/providers/interface.ts";
82+
export type {
83+
DeploymentInfo,
84+
DeploymentListFilter,
85+
DeploymentListResult,
86+
DeploymentRunResult,
87+
} from "./internal/providers/interface.ts";
88+
89+
export {
90+
archiveRemoteSession,
91+
downloadRemoteFile,
92+
downloadRemoteSkill,
93+
getManagedAgentProviderCapabilities,
94+
getRemoteAgent,
95+
getRemoteDeployment,
96+
getRemoteDeploymentRun,
97+
getRemoteEnvironment,
98+
getRemoteSkill,
99+
getRemoteSkillDownloadInfo,
100+
getRemoteSkillVersion,
101+
getRemoteVault,
102+
listRemoteAgents,
103+
listRemoteAgentVersions,
104+
listRemoteDeploymentRuns,
105+
listRemoteDeployments,
106+
listRemoteEnvironments,
107+
listRemoteFiles,
108+
listRemoteSkills,
109+
listRemoteSkillVersions,
110+
listRemoteVaults,
111+
runRemoteDeployment,
112+
sendRemoteSessionEvents,
113+
setRemoteDeploymentPaused,
114+
updateRemoteSession,
115+
} from "./internal/core/managed-api-runtime.ts";
116+
export type { ManagedApiTarget } from "./internal/core/managed-api-runtime.ts";
117+
export type {
118+
AgentListOptions,
119+
AgentPage,
120+
AgentVersionListOptions,
121+
CursorListOptions,
122+
CursorPage,
123+
DeploymentRunInfo,
124+
DeploymentRunPage,
125+
EnvironmentListOptions,
126+
EnvironmentPage,
127+
FileListOptions,
128+
FilePage,
129+
ManagedAgentOperationAuth,
130+
ManagedAgentOperationCapability,
131+
ManagedAgentProviderCapabilities,
132+
SessionEventInput,
133+
SessionEventSendResult,
134+
SessionUpdateInput,
135+
SkillDownloadInfo,
136+
SkillListOptions,
137+
SkillPage,
138+
SkillVersionInfo,
139+
SkillVersionListOptions,
140+
SkillVersionPage,
141+
VaultListOptions,
142+
VaultPage,
143+
} from "./internal/types/managed-api.ts";
83144

84145
export type {
85146
DestroyDefaultMemoryStoreResult,
@@ -198,8 +259,13 @@ export {
198259
type ProviderConfig,
199260
type ProviderConfigProvider,
200261
} from "./internal/provider-config.ts";
201-
export type { ProviderSessionInfo } from "./internal/types/session.ts";
202-
export type { ProviderSessionEvent } from "./internal/types/session-event.ts";
262+
export type { ProviderSessionInfo, SessionFilter, SessionListResult } from "./internal/types/session.ts";
263+
export type {
264+
EventListOptions,
265+
EventStreamOptions,
266+
ProviderSessionEvent,
267+
ProviderSessionEventList,
268+
} from "./internal/types/session-event.ts";
203269
export type { ProviderFileInfo } from "./internal/types/file.ts";
204270
export type { ProviderSkillInfo } from "./internal/types/skill-info.ts";
205271

0 commit comments

Comments
 (0)