import { a4 as MultiagentMemberDecl, f as AgentListOptions, e as AgentPage, A as AgentVersionListOptions, E as EnvironmentListOptions, h as EnvironmentPage, V as VaultListOptions, p as VaultPage, w as EnvironmentDecl, x as VaultDecl, N as CredentialDecl, a3 as VaultCredentialInfo, v as SkillDecl, u as AgentDecl, a5 as DefaultMemoryStoreDecl, a6 as IdentityDecl, a7 as ChannelDecl, Z as MemoryStoreDecl, W as DeploymentDecl, T as CursorListOptions, g as DeploymentRunPage, D as DeploymentRunInfo, F as FileListOptions, i as FilePage, b as ProviderSkillInfo, n as SkillListOptions, o as SkillPage, l as SkillVersionListOptions, m as SkillVersionPage, d as SkillVersionInfo, c as SkillDownloadInfo, I as SessionBindings, a as ProviderSessionInfo, C as SessionFilter, $ as SessionListResult, t as SessionUpdateInput, q as SessionResourceMountInput, S as SessionResourceInfo, j as SessionResourceListOptions, k as SessionResourcePage, r as SessionEventInput, s as SessionEventSendResult, G as EventStreamOptions, H as ProviderSessionEvent, B as EventListOptions, z as ProviderSessionEventList, K as SessionThreadListOptions, L as SessionThreadPage, R as ResolvedProjectConfig } from './session-thread-K0mtKer0.js'; import { P as PlannedAction, D as Diagnostic, f as ResourceAddress, R as ResourceType, C as CloudAgent, c as CloudEnvironment, d as CloudVault } from './dto-CIYO4YQw.js'; import { P as ProviderFileInfo } from './file-Cj5-Vx27.js'; interface ExecutionPlan { actions: PlannedAction[]; diagnostics: Diagnostic[]; } /** Detailed contracts are opt-in; the default public result retains its legacy shape. */ type ResourceResultDetail = "legacy" | "structured"; type ResourceExecutionOutcome = "succeeded" | "failed" | "partial" | "unknown"; type ResourceErrorPhase = "plan" | "prepare" | "execute" | "persist_state"; interface ResourceErrorInfo { code: string; phase: ResourceErrorPhase; /** Safe summary, never a raw Provider response or request. */ message: string; /** Transient failure hint, not permission to replay a mutation. */ retryable: boolean; /** False only when no mutating Provider method has been invoked. */ mutationStarted: boolean; httpStatus?: number; } interface ResourceActionResult { action: PlannedAction; status: "success" | "failed" | "skipped"; error?: string; errorInfo?: ResourceErrorInfo; resource?: { remoteId: string; version?: number; }; } interface ResourceExecutionResult { results: ResourceActionResult[]; /** Legacy meaning: at least one action failed. */ partial: boolean; outcome?: ResourceExecutionOutcome; mutationStarted?: boolean; } type SelfMember = Extract; type ResolvedMultiagentMember = SelfMember | { /** Present only when the member is owned and named by this project. */ logical_name?: string; resource_type: "agent" | "template"; remote_id: string; }; interface ResolvedMultiagentRoster { type: "coordinator"; members: ResolvedMultiagentMember[]; } type MemoryMetadata = Record; interface MemoryStoreInfo { [key: string]: unknown; id: string; type: "memory_store"; name: string; description: string; metadata: MemoryMetadata; status?: "active" | "archived" | string; entry_count?: number; total_size?: number; session_count?: number; created_by?: MemoryActor; created_at: string; updated_at: string; archived_at?: string | null; } interface MemoryInfo { [key: string]: unknown; id: string; type: "memory"; memory_store_id: string; path: string; content?: string | null; content_size_bytes: number; content_sha256: string; version?: number; memory_version_id?: string; metadata?: MemoryMetadata; created_by?: MemoryActor; created_at: string; updated_at: string; } interface MemoryPrefixInfo { type: "memory_prefix"; path: string; } type MemoryListItem = MemoryInfo | MemoryPrefixInfo; type MemoryVersionOperation = "created" | "updated" | "modified" | "deleted"; interface MemoryActor { type: string; api_key_id?: string; session_id?: string; user_id?: string; } interface MemoryVersionInfo { [key: string]: unknown; id: string; type: "memory_version"; memory_store_id: string; memory_id: string; path?: string | null; content?: string | null; content_size_bytes?: number | null; content_sha256?: string | null; operation: MemoryVersionOperation; version?: number; redacted?: boolean; redacted_at?: string | null; created_by?: MemoryActor; created_at: string; } interface MemoryPage { [key: string]: unknown; data: T[]; /** Portable pagination used by existing providers. Native APIs may omit it. */ has_more?: boolean; next_cursor?: string; /** Opaque native page cursor. Null or absence indicates the last page. */ next_page?: string | null; /** Child directory prefixes returned by native depth=1 listings. */ prefixes?: string[]; } interface MemoryDeleteResult { [key: string]: unknown; id: string; type: "memory_deleted"; } interface MemoryContentPrecondition { type: "content_sha256"; content_sha256: string; } interface MemoryProviderCapabilities { archive_store: boolean; batch_create: boolean; versions: boolean; optimistic_concurrency: boolean; memory_metadata: boolean; } interface MemoryStoreListOptions { limit?: number; cursor?: string; page?: string; include_archived?: boolean; } interface MemoryListOptions { limit?: number; cursor?: string; page?: string; prefix?: string; path_prefix?: string; depth?: number; view?: "basic" | "full"; } interface MemoryVersionListOptions { limit?: number; cursor?: string; page?: string; memory_id?: string; operation?: MemoryVersionOperation; "created_at.gte"?: string; "created_at.lte"?: string; view?: "basic" | "full"; } interface CreateMemoryStoreInput { name: string; description?: string; metadata?: MemoryMetadata; } interface UpdateMemoryStoreInput { name?: string; description?: string; metadata?: MemoryMetadata; } interface CreateMemoryInput { path: string; content: string; metadata?: MemoryMetadata; } interface BatchCreateMemoryInput { items: CreateMemoryInput[]; on_conflict?: "overwrite" | "fail"; } interface BatchCreateMemoryResultItem { path: string; memory?: MemoryInfo; error?: { type: string; message: string; }; } interface BatchCreateMemoryResult { results: BatchCreateMemoryResultItem[]; } interface UpdateMemoryInput { path?: string; content?: string; metadata?: MemoryMetadata; expected_content_sha256?: string; precondition?: MemoryContentPrecondition; } interface SkillFile { relativePath: string; content: Buffer; } interface ResourceState { address: ResourceAddress; remote_id: string | null; /** * This resource is owned by the provider or another system and is only * referenced by this project. It must never be deleted remotely. */ externally_managed?: boolean; /** Provider API domain that owns the remote resource (currently relevant to Qoder). */ api_mode?: "managed" | "forward" | "auto"; /** New-store initialization checkpoint; existing and imported stores never acquire it. */ memory_initialization?: { pending_entries: Array<{ path: string; content_sha256: string; }>; }; version?: number; /** * Backward-compatible alias for desired_hash. Kept while older state files * and callers still read/write content_hash directly. */ content_hash: string; desired_hash?: string; desired_comparable_hash?: string; desired_readiness_baseline?: ResourceReadinessBaseline; remote_hash?: string; remote_snapshot?: unknown; /** Non-reversible declaration fingerprint used to infer safe logical renames. */ replacement_fingerprint?: string; drift_paths?: string[]; drift_status?: "in_sync" | "drifted" | "missing" | "unchecked"; } interface ResourceReadinessBaseline { operational_hash: string; description_hash: string; metadata_hash: string; } interface StateFile { resources: ResourceState[]; pending_default_memory_store_cleanups?: PendingDefaultMemoryStoreCleanup[]; } interface PendingDefaultMemoryStoreCleanup { agent_name: string; provider: string; remote_id: string; identity_id?: string; template_id?: string; last_error?: string; } /** * Usage summary scope, discriminated by `dimension` (app-control usage.summary): * - `workspace`: aggregated over the caller's whole workspace; no agent/session narrowing. * - `agent`: one Agent (optionally a pinned version). * - `session`: one Session; its lifecycle totals are used, so `time_range` and * `granularity` must not be sent. */ type UsageDimension = "workspace" | "agent" | "session"; /** Trend scope: the trend endpoint has no `session` dimension. */ type UsageTrendDimension = "workspace" | "agent"; /** * Bucket size of `query_range` and trend points. Omit it and the server picks * from the span; do not send an explicit `null`. */ type UsageGranularity = "hour" | "day" | "month"; /** RFC 3339 window carrying an explicit offset, e.g. `2026-11-02T10:00:00+08:00`. */ interface UsageTimeRange { start_time: string; end_time: string; } /** `workspace` scope: window aggregation only; no agent or session narrowing. */ interface UsageWorkspaceSummaryRequest { dimension: "workspace"; time_range: UsageTimeRange; /** Omit to let the server pick the bucket from the span; never send null. */ granularity?: UsageGranularity; agent_id?: never; agent_version?: never; session_id?: never; } /** One Agent (optionally a pinned version); Session narrowing is not accepted. */ interface UsageAgentSummaryRequest { dimension: "agent"; /** Required for the `agent` dimension. */ agent_id: string; /** Null means every version. */ agent_version?: string | null; time_range: UsageTimeRange; granularity?: UsageGranularity; session_id?: never; } /** One Session's lifecycle totals; the Session's own window is used. */ interface UsageSessionSummaryRequest { dimension: "session"; /** Required for the `session` dimension. */ session_id: string; time_range?: never; granularity?: never; agent_id?: never; agent_version?: never; } /** * Summary request branches per dimension: a missing required field or a forbidden * cross-dimension field is a compile error, not just a runtime rejection. The * runtime contract checks stay in place for untyped callers. */ type UsageSummaryRequest = UsageWorkspaceSummaryRequest | UsageAgentSummaryRequest | UsageSessionSummaryRequest; /** Cursor pagination shared by both trend branches. */ interface UsageTrendPageOptions { /** Page size 1..100; omitted means the server default (100). */ page_size?: number; /** Opaque cursor from the previous page's `next_page_token`; valid for 15 minutes. */ page_token?: string; } /** `workspace` trend branch: window aggregation only. */ interface UsageWorkspaceTrendRequest extends UsageTrendPageOptions { dimension: "workspace"; time_range: UsageTimeRange; /** Omit to let the server pick the bucket from the span; never send null. */ granularity?: UsageGranularity; agent_id?: never; agent_version?: never; } /** `agent` trend branch: one Agent (optionally a pinned version). */ interface UsageAgentTrendRequest extends UsageTrendPageOptions { dimension: "agent"; /** Required for the `agent` dimension. */ agent_id: string; /** Null means every version. */ agent_version?: string | null; time_range: UsageTimeRange; granularity?: UsageGranularity; } /** Bucketed trend for `workspace`/`agent`; `session` has no trend dimension. */ type UsageTrendRequest = UsageWorkspaceTrendRequest | UsageAgentTrendRequest; /** * Every indicator carries its own unit. An unknown indicator keeps its unit with a * `null` value; a known zero stays `0` and must not be treated as unknown. */ interface UsageMetric { value: number | null; unit: string; } /** Per-model indicators (`usage.models[].usage`). */ interface UsageModelMetrics { input_tokens: UsageMetric; output_tokens: UsageMetric; total_tokens: UsageMetric; cache_read_tokens: UsageMetric; cache_creation_tokens: UsageMetric; cache_hit_ratio: UsageMetric; call_count: UsageMetric; failed_count: UsageMetric; } /** Per-tool indicators (`usage.tools[].usage`); tools carry no token or runtime columns. */ interface UsageToolMetrics { call_count: UsageMetric; failed_count: UsageMetric; } /** Whole-scope indicators (`usage.total`). */ interface UsageTotal { input_tokens: UsageMetric; output_tokens: UsageMetric; total_tokens: UsageMetric; cache_read_tokens: UsageMetric; cache_creation_tokens: UsageMetric; cache_hit_ratio: UsageMetric; model_call_count: UsageMetric; tool_call_count: UsageMetric; builtin_tool_call_count: UsageMetric; mcp_tool_call_count: UsageMetric; custom_tool_call_count: UsageMetric; turns: UsageMetric; steps: UsageMetric; interrupt_error_count: UsageMetric; model_failed_count: UsageMetric; tool_failed_count: UsageMetric; runtime_ms: UsageMetric; } /** * One aggregated model row. `model_name` is null when the provider could not * attribute the calls; ordering is not guaranteed. */ interface UsageModelRow { model_name: string | null; usage: UsageModelMetrics; } /** * One aggregated tool row. Rows are keyed by `source` + `tool_name`, so * same-name tools from different sources stay separate. */ interface UsageToolRow { source: string | null; tool_name: string | null; usage: UsageToolMetrics; } /** * `total`, `models` and `tools` are three views of the same query — never add * the total to the detail rows. */ interface UsageBreakdown { total: UsageTotal; models: UsageModelRow[]; tools: UsageToolRow[]; } /** Aggregated usage for one scope (summary endpoint). */ interface UsageSummary { /** * Effective window after the server aligned it to `granularity` (UTC+8). * The `session` dimension has no caller-supplied window and may omit it. */ query_range?: UsageTimeRange; /** Latest known data refresh time; null when no statistics exist. */ data_updated_at: string | null; usage: UsageBreakdown; } interface UsageSummaryResponse { /** Server-side request id, kept for support triage. */ request_id: string; data: UsageSummary; } /** One trend bucket. Buckets without data are omitted, not zero-filled. */ interface UsageTrendPoint { start_time: string; end_time: string; usage: UsageBreakdown; } /** One page of trend buckets; `total/models/tools` describe that bucket only. */ interface UsageTrend { /** Effective window after the server aligned it to `granularity` (UTC+8). */ query_range: UsageTimeRange; data_updated_at: string | null; granularity: UsageGranularity; points: UsageTrendPoint[]; has_more: boolean; /** Cursor for the next page; null on the last page or when it expired. */ next_page_token: string | null; } interface UsageTrendResponse { /** Server-side request id, kept for support triage. */ request_id: string; data: UsageTrend; } interface UsageQueryOptions { signal?: AbortSignal; } /** Fields returned for a workspace Webhook endpoint. Signing secrets are separate. */ interface WebhookEndpoint { id: string; description: string | null; url: string; events: string[]; status: "ACTIVE" | "DISABLED"; disabled_reason: string | null; consecutive_fail: number; last_success_at: string | null; last_failure_at: string | null; created_at: string; updated_at: string; /** Present on individual endpoint responses, absent on list entries. */ request_id?: string; } interface CreateWebhookEndpointInput { url: string; events: string[]; description?: string; } /** Omitted fields are unchanged; events replaces the full subscription array. */ interface UpdateWebhookEndpointInput { url?: string; events?: string[]; /** null and the empty string both clear the description. */ description?: string | null; } interface WebhookEndpointWithSecret extends WebhookEndpoint { /** Returned only once, on creation. Hosts must deliver it without logging or persisting it implicitly. */ signing_secret: string; request_id: string; } /** The endpoint list is not paginated. */ interface WebhookEndpointList { data: WebhookEndpoint[]; request_id: string; } interface WebhookDeleteResult { request_id: string; } interface WebhookSecretResetResult { id: string; /** Returned only once; the previous secret is invalidated by the server. */ signing_secret: string; updated_at: string; request_id: string; } interface WebhookEventData { id: string; type: string; workspace_id: string; session_thread_id?: string; vault_id?: string; [field: string]: unknown; } interface WebhookEvent { type: "event"; id: string; created_at: string; data: WebhookEventData; } interface WebhookTestResult extends WebhookEvent { request_id: string; } interface WebhookDelivery { webhook_id: string; /** The provider owns delivery states; do not assume a closed set of values. */ status: string; attempt_count: number; delivery_at: string | null; finish_at: string | null; failure_reason: string | null; } interface WebhookEventWithDelivery extends WebhookEvent { delivery: WebhookDelivery; } /** Preserve the opaque nullable cursor and request ID, without synthesizing has_more. */ interface WebhookEventPage { data: WebhookEventWithDelivery[]; next_page: string | null; request_id: string; } interface WebhookRequestOptions { provider?: string; signal?: AbortSignal; } interface WebhookEventListOptions extends WebhookRequestOptions { /** Provider default is 20; supported values are 1 through 100. */ limit?: number; page?: string; } interface RemoteResource { id: string | null; type: string; version?: number; } /** Optional execution fact sink; observing an ID does not mean the resource is fully configured. */ type ResourceCreationObserver = (resource: Pick) => void; type ProviderResourceMode = "managed" | "forward" | "auto"; interface ModelInfo { id: string; display_name: string; source: string; is_enabled: boolean; is_new: boolean; price_factor?: number; efforts?: string[]; default_effort?: string; } type DriftSupport = "full" | "existence" | "unsupported"; interface ComparableRemoteResource { id: string | null; type: string; version?: number; comparable: unknown; snapshot?: unknown; } /** * A remote resource reverse-mapped into a `agents.yaml` declaration, ready to be * serialized under the matching top-level group (e.g. `vaults.`). * `name` is the yaml key; `decl` matches the corresponding zod schema shape. */ interface ExportedResource { name: string; decl: Record; } interface ResolvedAgentRefs { skill_ids: Array<{ type: string; skill_id: string; version?: string; }>; multiagent?: ResolvedMultiagentRoster; } interface ResolvedTemplateRefs extends ResolvedAgentRefs { environment_id: string; /** Qoder BYOC private-network route used by Forward Templates. */ tunnel_id?: string; vault_ids: string[]; file_ids?: string[]; identity_id?: string; memory_store_ids?: string[]; /** Forward Store ids owned by this project and therefore safe to detach during reconciliation. */ owned_memory_store_ids?: string[]; } interface ResolvedDeploymentRefs { agent_id: string; agent_version?: number; environment_id: string; /** Qoder BYOC tunnel id. Passed through only when the deployment targets Qoder BYOC. */ tunnel_id?: string; vault_ids: string[]; memory_store_ids: Record; } interface ResolvedChannelRefs { identity_id?: string; agent_id?: string; } interface DefaultMemoryStoreReconcileResult { status: "updated" | "unchanged" | "pending"; memory_store_id?: string; } interface DeploymentContext { id: string | null; name: string; decl: DeploymentDecl; refs: ResolvedDeploymentRefs; basePath: string; } interface DeploymentRunResult { run_id?: string; session_id: string | null; error?: { type: string; message: string; }; } interface DeploymentInfo { id: string | null; status: string; /** Deployment variables echoed as a string map by Bailian. */ environment_variables?: Record; paused_reason?: { type: string; error?: { type: string; }; }; schedule?: { expression: string; timezone?: string; }; attributes?: Record; } interface DeploymentListFilter { agent_id?: string; /** Bailian server-side fuzzy match against deployment id or name. */ keyword?: string; status?: "active" | "paused"; include_archived?: boolean; limit?: number; page?: string; created_at_gte?: string; created_at_lte?: string; } interface DeploymentListResult { deployments: DeploymentInfo[]; has_more: boolean; next_page?: string; } interface ProviderAdapter { readonly name: string; /** * Whether `sendSessionMessage` returns an event-id cursor the stream/poll can * resume after. true → send-then-stream with `afterId`; false → connect-before-send. */ readonly eventResume: boolean; readonly memoryCapabilities?: MemoryProviderCapabilities; validate(): Promise; /** False for resource kinds whose non-unique names cannot identify an existing remote resource. */ supportsResourceNameLookup?(type: ResourceType): boolean; /** * Locate a remote resource. When `id` is provided, the resource is verified * precisely via its detail endpoint (`GET /{endpoint}/{id}`), which avoids the * ambiguity of name matching when names are not unique. Without `id`, falls * back to listing and matching by `name` (used by conflict adoption), unless * supportsResourceNameLookup returns false for that resource kind. */ findResource(type: ResourceType, name: string, id?: string | null, mode?: ProviderResourceMode): Promise; listAgents?(filter?: { prefix?: string; limit?: number; }): Promise; /** Cursor-preserving API listing used by command surfaces. */ listAgentResources?(options?: AgentListOptions): Promise; getRemoteAgent?(id: string, version?: number, options?: { signal?: AbortSignal; }): Promise; listAgentVersions?(id: string, options?: AgentVersionListOptions): Promise; listEnvironments?(filter?: { limit?: number; }): Promise; listEnvironmentResources?(options?: EnvironmentListOptions): Promise; getRemoteEnvironment?(id: string): Promise; listVaults?(filter?: { limit?: number; }): Promise; listVaultResources?(options?: VaultListOptions): Promise; getRemoteVault?(id: string): Promise; getDriftSupport?(type: ResourceType): DriftSupport; readComparableResource?(type: ResourceType, id: string | null, name: string, decl?: unknown): Promise; /** * Canonical desired form for drift comparison. `refs` carries resolved * skill and multiagent references; callers only compute it for agent/template * resources where they have config + state at hand. */ normalizeDesiredResource?(type: ResourceType, name: string, decl: unknown, refs?: ResolvedAgentRefs | ResolvedTemplateRefs): unknown | null; /** * Reverse-map remote resources of a given type into `agents.yaml` declarations * (used by `agents sync`). Returns an empty array for unsupported types. Secret * values that the provider does not return are emitted as `${ENV}` placeholders. */ exportResources?(type: ResourceType): Promise; /** Workspace-level APIs do not participate in project declaration or state. */ createWebhookEndpoint?(input: CreateWebhookEndpointInput, options?: WebhookRequestOptions): Promise; listWebhookEndpoints?(options?: WebhookRequestOptions): Promise; getWebhookEndpoint?(id: string, options?: WebhookRequestOptions): Promise; updateWebhookEndpoint?(id: string, input: UpdateWebhookEndpointInput, options?: WebhookRequestOptions): Promise; deleteWebhookEndpoint?(id: string, options?: WebhookRequestOptions): Promise; enableWebhookEndpoint?(id: string, options?: WebhookRequestOptions): Promise; disableWebhookEndpoint?(id: string, options?: WebhookRequestOptions): Promise; testWebhookEndpoint?(id: string, options?: WebhookRequestOptions): Promise; resetWebhookSecret?(id: string, options?: WebhookRequestOptions): Promise; listWebhookEvents?(id: string, options?: WebhookEventListOptions): Promise; createEnvironment(name: string, decl: EnvironmentDecl, mode?: ProviderResourceMode): Promise; updateEnvironment(id: string, name: string, decl: EnvironmentDecl, mode?: ProviderResourceMode): Promise; deleteEnvironment(id: string, cascade?: boolean, mode?: ProviderResourceMode): Promise; createVault(name: string, decl: VaultDecl, mode?: ProviderResourceMode, onCreated?: ResourceCreationObserver): Promise; deleteVault(id: string, mode?: ProviderResourceMode): Promise; createCredential?(vaultId: string, credential: CredentialDecl): Promise; listCredentials?(vaultId: string): Promise; createSkill(name: string, decl: SkillDecl, files: SkillFile[], mode?: ProviderResourceMode): Promise; updateSkill(id: string, name: string, decl: SkillDecl, files: SkillFile[], mode?: ProviderResourceMode): Promise; deleteSkill(id: string, mode?: ProviderResourceMode): Promise; createAgent(name: string, decl: AgentDecl, refs: ResolvedAgentRefs): Promise; updateAgent(id: string, name: string, decl: AgentDecl, refs: ResolvedAgentRefs): Promise; deleteAgent(id: string): Promise; createTemplate?(name: string, decl: AgentDecl, refs: ResolvedTemplateRefs): Promise; updateTemplate?(id: string, name: string, decl: AgentDecl, refs: ResolvedTemplateRefs): Promise; /** Remove the template from desired state. Qoder implements this as a soft archive. */ archiveTemplate?(id: string, ownedMemoryStoreIds?: string[]): Promise; reconcileDefaultMemoryStore?(identityId: string, templateId: string, desired: DefaultMemoryStoreDecl): Promise; findDefaultMemoryStoreId?(identityId: string, templateId: string): Promise; deleteDefaultMemoryStore?(id: string): Promise; createIdentity?(name: string, decl: IdentityDecl): Promise; updateIdentity?(id: string, name: string, decl: IdentityDecl): Promise; deleteIdentity?(id: string): Promise; createChannel?(name: string, decl: ChannelDecl, refs: ResolvedChannelRefs): Promise; updateChannel?(id: string, name: string, decl: ChannelDecl, refs: ResolvedChannelRefs): Promise; deleteChannel?(id: string): Promise; createMemoryStore?(name: string, decl: MemoryStoreDecl, mode?: ProviderResourceMode): Promise; deleteMemoryStore?(id: string, mode?: ProviderResourceMode): Promise; listMemoryStores?(options?: MemoryStoreListOptions): Promise>; getMemoryStore?(id: string): Promise; updateMemoryStore?(id: string, input: UpdateMemoryStoreInput, mode?: ProviderResourceMode): Promise; archiveMemoryStore?(id: string): Promise; createMemory?(storeId: string, input: CreateMemoryInput, mode?: ProviderResourceMode): Promise; batchCreateMemories?(storeId: string, input: BatchCreateMemoryInput): Promise; listMemories?(storeId: string, options?: MemoryListOptions, mode?: ProviderResourceMode): Promise>; getMemory?(storeId: string, memoryId: string): Promise; updateMemory?(storeId: string, memoryId: string, input: UpdateMemoryInput, mode?: ProviderResourceMode): Promise; deleteMemory?(storeId: string, memoryId: string, expectedContentSha256?: string): Promise; listMemoryVersions?(storeId: string, options?: MemoryVersionListOptions): Promise>; getMemoryVersion?(storeId: string, versionId: string): Promise; redactMemoryVersion?(storeId: string, versionId: string): Promise; createDeployment(name: string, decl: DeploymentDecl, refs: ResolvedDeploymentRefs, basePath: string): Promise; updateDeployment(id: string, name: string, decl: DeploymentDecl, refs: ResolvedDeploymentRefs, basePath: string, preparedFiles?: ReadonlyMap): Promise; deleteDeployment(id: string): Promise; runDeployment(ctx: DeploymentContext): Promise; getDeployment(ctx: DeploymentContext): Promise; listDeployments?(filter?: DeploymentListFilter): Promise; getDeploymentById?(id: string): Promise; runDeploymentById?(id: string): Promise; pauseDeploymentById?(id: string): Promise; unpauseDeploymentById?(id: string): Promise; listDeploymentRuns?(deploymentId: string, options?: CursorListOptions): Promise; getDeploymentRun?(runId: string): Promise; pauseDeployment?(ctx: DeploymentContext): Promise; unpauseDeployment?(ctx: DeploymentContext): Promise; uploadFile(filePath: string, options?: { name?: string; purpose?: string; }, mode?: ProviderResourceMode): Promise; /** Upload from in-memory content (no filesystem), for server contexts that receive bytes directly (e.g. webui browser uploads). */ uploadFileContent(content: Uint8Array, filename: string, options?: { mimeType?: string; purpose?: string; }): Promise; deleteFile(id: string, mode?: ProviderResourceMode): Promise; /** Fetch a single file's metadata (incl. scan `status`); used to gate session binding on availability. */ getFileInfo?(id: string): Promise; /** * Resolve a short-lived presigned download URL for a file (e.g. an agent-delivered artifact). * Optional — only providers with a content/download endpoint implement it (qoder GET * /files/{id}/content). Callers fetch it on demand so the URL never goes stale in the UI. */ getFileDownloadUrl?(id: string): Promise<{ url: string; expires_at?: string; }>; /** List workspace user-uploaded files (newest first). Optional — only providers with a list API implement it. */ listFiles?(): Promise; listFileResources?(options?: FileListOptions): Promise; downloadFileContent?(id: string): Promise; /** * List skills (newest first). `source` selects the catalog: "custom" (workspace-uploaded, the * default) or "official" (the provider's built-in catalog). Optional — only providers with a * list API implement it. */ listSkills?(source?: "custom" | "official"): Promise; listSkillResources?(options?: SkillListOptions): Promise; /** Fetch a single skill's metadata (incl. scan `status`); used to poll create → active. */ getSkillInfo?(id: string): Promise; listSkillVersions?(id: string, options?: SkillVersionListOptions): Promise; getSkillVersion?(id: string, version: string): Promise; getSkillDownloadInfo?(id: string, version: string): Promise; /** * Create a skill from an already-uploaded zip's file_id and return immediately with the * initial (usually `checking`) status. NON-blocking — unlike `createSkill`, it does NOT wait * for the security scan. The webui polls `getSkillInfo` until `active`. */ createSkillFromFileId?(fileId: string): Promise; createSession(bindings: SessionBindings): Promise; listSessions(filter?: SessionFilter): Promise; getSession(id: string): Promise; updateSession?(id: string, input: SessionUpdateInput): Promise; archiveSession?(id: string): Promise; deleteSession(id: string): Promise; /** Mount one resource into a RUNNING session. Produces no session events. */ mountSessionResource?(sessionId: string, input: SessionResourceMountInput): Promise; listSessionResources?(sessionId: string, options?: SessionResourceListOptions): Promise; getSessionResource?(sessionId: string, resourceId: string): Promise; /** Unmount one resource and clear the provider's internal file copy. Unrecoverable. */ unmountSessionResource?(sessionId: string, resourceId: string): Promise; sendSessionMessage(sessionId: string, message: string): Promise; sendSessionEvents?(sessionId: string, events: SessionEventInput[]): Promise; streamSessionEvents(sessionId: string, options?: EventStreamOptions): AsyncIterable; listSessionEvents(sessionId: string, options?: EventListOptions): Promise; listSessionThreads?(sessionId: string, options?: SessionThreadListOptions): Promise; listSessionThreadEvents?(sessionId: string, threadId: string, options?: EventListOptions): Promise; listModels?(): Promise; /** * Aggregated usage summary (model and tool details) for one dimension * (app-control usage.summary). Bailian-only today; other providers reject at * the runtime seam. */ getUsageSummary?(request: UsageSummaryRequest, options?: UsageQueryOptions): Promise; /** * Bucketed usage trend for workspace/agent (app-control usage.trend). * Cursor-paged via `page_size`/`page_token`; Bailian-only today, other * providers reject at the runtime seam. */ getUsageTrend?(request: UsageTrendRequest, options?: UsageQueryOptions): Promise; /** * Download all remote skills and return their extracted file content. * Used by `agents sync` to materialize skill sources locally. * Returns a map of skill name → extracted SkillFile[]. */ downloadAllSkillFiles?(): Promise>; } interface IStateManager { getResource(address: ResourceAddress): ResourceState | undefined; setResource(resource: ResourceState): void; removeResource(address: ResourceAddress): void; listResources(): ResourceState[]; findResource(query: { type: string; name: string; provider?: string; }): ResourceState | undefined; getStateFile(): StateFile; save(): Promise; } declare class StateManager implements IStateManager { private state; private path; private index; private pendingSave; private constructor(); private buildIndex; static load(path: string): Promise; static initialize(path: string): StateManager; getResource(address: ResourceAddress): ResourceState | undefined; setResource(resource: ResourceState): void; removeResource(address: ResourceAddress): void; listResources(): ResourceState[]; findResource(query: { type: string; name: string; provider?: string; }): ResourceState | undefined; getStateFile(): StateFile; save(): Promise; private writeSnapshot; } interface StateScope { projectId: string; } interface StateBackend { read(scope: StateScope, fn: (state: IStateManager) => Promise | T): Promise; write(scope: StateScope, fn: (state: IStateManager) => Promise | T): Promise; } interface ProjectRuntimeContext { configPath?: string; statePath?: string; projectName: string; config: ResolvedProjectConfig; state: IStateManager; providers: Map; } interface CreateRuntimeInput { projectName: string; config: ResolvedProjectConfig; state: IStateManager; configPath?: string; providers?: Record; } interface BackendRuntimeInput { projectName: string; config: ResolvedProjectConfig; stateBackend: StateBackend; stateScope: StateScope; configPath?: string; providers?: Record; } /** * Context-first entry point: create a ProjectRuntimeContext from pre-resolved objects. * No file I/O is performed — the caller is responsible for loading and resolving config. */ declare function createProjectRuntime(input: CreateRuntimeInput): ProjectRuntimeContext; declare function readProjectRuntime(input: BackendRuntimeInput, fn: (ctx: ProjectRuntimeContext) => Promise | T): Promise; declare function writeProjectRuntime(input: BackendRuntimeInput, fn: (ctx: ProjectRuntimeContext) => Promise | T): Promise; interface ResolveProjectConfigOptions { /** Override the derived project name (defaults to the config file's parent directory). */ projectName?: string; /** Expand `${env:...}` references while loading (defaults to true). */ resolveEnv?: boolean; /** Project-local fallback values; the process environment takes precedence. Never mutates process.env. */ environment?: Record; } interface LoadedProjectConfig { configPath: string; projectName: string; config: ResolvedProjectConfig; /** Root config and local files/directories that influence the resolved project. */ sourcePaths: string[]; } /** * Shared config-resolution spine for every host: load the config file, raise * configuration errors as a UserError, then resolve file references. Interfaces * call this instead of re-implementing the load-and-resolve sequence. */ declare function resolveProjectConfig(filePath: string, options?: ResolveProjectConfigOptions): Promise; interface ResolveProjectConfigFromObjectOptions { /** Treat prompt and memory text as literal strings. File/Skill sources remain file references. */ textFileReferences?: "resolve" | "literal"; /** Project name to stamp onto the resolved config. */ projectName: string; /** Base path used to resolve any `file:` references (defaults to process.cwd()). */ basePath?: string; /** Resolve `${ENV_VAR}` references recursively before schema validation. */ resolveEnv?: boolean; /** Project-local fallback values; the process environment takes precedence. */ environment?: Record; } /** * Object-level twin of {@link resolveProjectConfig}: validate an in-memory config * object through the same zod schema and file-reference resolution instead of * reading from disk. Hosts that assemble config from env + code (rather than a * yaml file) use this so they don't bypass SDK invariants like the `_resolved` marker. */ declare function resolveProjectConfigFromObject(rawConfig: unknown, options: ResolveProjectConfigFromObjectOptions): Promise; type RuntimeFeedbackLevel = "info" | "success" | "warning" | "error"; type RuntimeFeedbackType = "resource_action_success" | "resource_action_failed" | "resource_already_gone" | "resource_adopted" | "refresh_resource_missing" | "refresh_drift_unchecked" | "refresh_resource_failed" | "provider_wait"; interface RuntimeFeedbackEvent { type: RuntimeFeedbackType; level: RuntimeFeedbackLevel; message: string; action?: PlannedAction; resource?: ResourceAddress; } type RuntimeFeedbackSink = (event: RuntimeFeedbackEvent) => void; interface ResourceRuntimeOptions extends DestructiveDecisionOptions { provider?: string; scope?: ResourcePlanScope; mode?: ResourceSyncMode; refresh?: boolean; refreshOnly?: boolean; quiet?: boolean; onFeedback?: RuntimeFeedbackSink; concurrency?: number; resultDetail?: ResourceResultDetail; } type ResourceSyncMode = "reconcile" | "create-only"; interface ResourcePlanScope { roots: ResourceAddress[]; includeDependencies?: boolean; } interface ResourceRefreshResult { removed: ResourceState[]; errors: Array<{ resource: ResourceState; error: string; errorInfo?: ResourceErrorInfo; }>; } interface ResourcePlanResult { /** Only present when resultDetail is structured. */ fingerprint?: string; executionContext: ProjectRuntimeContext; plan: ExecutionPlan; refreshResult?: ResourceRefreshResult; targetProviders?: string[]; destructiveActions: PlannedAction[]; selectedAddresses?: ResourceAddress[]; mode?: ResourceSyncMode; } type DestructivePolicy = "block" | "prompt" | "force"; interface DestructiveDecisionOptions { policy?: DestructivePolicy; confirm?: (actions: PlannedAction[]) => boolean | Promise; } interface ResourceSyncRun { planned: ResourcePlanResult; execution?: ResourceExecutionResult; } declare function planProjectWithStateBackend(input: BackendRuntimeInput, options?: ResourceRuntimeOptions): Promise; declare function syncProjectResourcesWithStateBackend(input: BackendRuntimeInput, options?: ResourceRuntimeOptions): Promise; declare function importResource(ctx: ProjectRuntimeContext, address: ResourceAddress, remoteId: string, options?: { resourceVersion?: number; }): Promise; declare function planProjectContext(ctx: ProjectRuntimeContext, options?: ResourceRuntimeOptions): Promise; interface ResourceExecutionOptions extends DestructiveDecisionOptions { onFeedback?: RuntimeFeedbackSink; concurrency?: number; resultDetail?: ResourceResultDetail; } declare function executePlannedProject(planned: ResourcePlanResult, options?: ResourceExecutionOptions): Promise; declare function decideDestructive(destructiveActions: PlannedAction[], options?: DestructiveDecisionOptions): Promise<"proceed" | "blocked" | "cancelled">; export { type StateFile as $, type MemoryPage as A, type BackendRuntimeInput as B, type CreateWebhookEndpointInput as C, type DeploymentContext as D, type MemoryListItem as E, type MemoryStoreListOptions as F, type MemoryVersionListOptions as G, type UpdateMemoryInput as H, type UpdateMemoryStoreInput as I, type ResourcePlanResult as J, type ResourceSyncMode as K, type DestructivePolicy as L, type ModelInfo as M, type RemoteResource as N, type UsageQueryOptions as O, type ProjectRuntimeContext as P, type UsageSummaryRequest as Q, type ResourceErrorInfo as R, type SkillFile as S, type UsageSummaryResponse as T, type UpdateWebhookEndpointInput as U, type UsageTrendRequest as V, type WebhookRequestOptions as W, type UsageTrendResponse as X, type StateBackend as Y, type StateScope as Z, type IStateManager as _, type ResourceExecutionResult as a, type LoadedProjectConfig as a0, type MemoryContentPrecondition as a1, type MemoryMetadata as a2, type MemoryPrefixInfo as a3, type MemoryVersionOperation as a4, type ResourceActionResult as a5, type ResourceErrorPhase as a6, type ResourceExecutionOptions as a7, type ResourceExecutionOutcome as a8, type ResourcePlanScope as a9, executePlannedProject as aA, importResource as aB, planProjectContext as aC, planProjectWithStateBackend as aD, readProjectRuntime as aE, resolveProjectConfig as aF, resolveProjectConfigFromObject as aG, syncProjectResourcesWithStateBackend as aH, writeProjectRuntime as aI, type ResourceRefreshResult as aa, type ResourceResultDetail as ab, type ResourceRuntimeOptions as ac, type ResourceSyncRun as ad, type RuntimeFeedbackEvent as ae, StateManager as af, type UsageBreakdown as ag, type UsageDimension as ah, type UsageGranularity as ai, type UsageMetric as aj, type UsageModelMetrics as ak, type UsageModelRow as al, type UsageSummary as am, type UsageTimeRange as an, type UsageToolMetrics as ao, type UsageToolRow as ap, type UsageTotal as aq, type UsageTrend as ar, type UsageTrendDimension as as, type UsageTrendPoint as at, type WebhookDelivery as au, type WebhookEvent as av, type WebhookEventData as aw, type WebhookEventWithDelivery as ax, createProjectRuntime as ay, decideDestructive as az, type WebhookEndpointWithSecret as b, type WebhookDeleteResult as c, type WebhookEndpoint as d, type WebhookEndpointList as e, type WebhookEventListOptions as f, type WebhookEventPage as g, type WebhookSecretResetResult as h, type WebhookTestResult as i, type DeploymentRunResult as j, type DeploymentInfo as k, type DeploymentListFilter as l, type DeploymentListResult as m, type ResourceState as n, type RuntimeFeedbackSink as o, type ProviderAdapter as p, type MemoryStoreInfo as q, type BatchCreateMemoryInput as r, type BatchCreateMemoryResult as s, type CreateMemoryInput as t, type MemoryInfo as u, type CreateMemoryStoreInput as v, type MemoryDeleteResult as w, type MemoryProviderCapabilities as x, type MemoryVersionInfo as y, type MemoryListOptions as z };