import { GlobalRepository } from '@mcoda/db'; import { normalizeGenerativeModalities, normalizeSelfHostedGenerativeOperation, type GenerativeModality, type MswarmArtifactRef, type MswarmGenericJobAuditEvent, type MswarmGenericJobLifecycleSnapshot, type MswarmGenericJobLogRecord, type MswarmJobEvent, type MswarmJobRequest, type MswarmJobType, type SelfHostedGenerativeOperation } from '@mcoda/shared'; export type { MswarmGenericJobLifecycleSnapshot } from '@mcoda/shared'; export { normalizeGenerativeModalities, normalizeSelfHostedGenerativeOperation, }; export type { GenerativeModality, SelfHostedGenerativeOperation, } from '@mcoda/shared'; export type MswarmSelfHostedNodeClientIdentityKind = 'domain' | 'ip' | 'uuid' | string; export interface MswarmSelfHostedNodeClientIdentity { kind: MswarmSelfHostedNodeClientIdentityKind; value: string; added_at?: string; addedAt?: string; } export interface MswarmCloudAgent { slug: string; provider: string; default_model: string; public_model_id?: string; input_modalities?: GenerativeModality[]; output_modalities?: GenerativeModality[]; operations?: SelfHostedGenerativeOperation[]; cost_per_million?: number; rating?: number; reasoning_rating?: number; max_complexity?: number; capabilities: string[]; health_status?: string; health_reason?: string; context_window?: number; max_output_tokens?: number; supports_tools: boolean; best_usage?: string; model_id?: string; upstream_model?: string; display_name?: string; description?: string; supports_reasoning?: boolean; pricing_snapshot_id?: string; pricing_version?: string; rating_samples?: number; rating_last_score?: number; rating_updated_at?: string; complexity_samples?: number; complexity_updated_at?: string; sync?: Record; } export interface MswarmSelfHostedAgent extends MswarmCloudAgent { agent_slug?: string; remote_slug?: string; adapter?: string; source_agent_id?: string; source_agent_slug?: string; load_balanced?: boolean; load_balanced_group_id?: string; selector_fingerprint?: string; member_count?: number; candidate_node_ids?: string[]; canonical_agent_slug?: string; canonical_model_id?: string; execution_class?: string; policy_class?: string; context_tier?: string; client_identity?: string; client_allowlist?: MswarmSelfHostedNodeClientIdentity[]; client_allowlist_count?: number; runtime_package_version?: string; gateway_base_url?: string; jobs_poll_path?: string; jobs_start_path_template?: string; jobs_events_path_template?: string; jobs_result_path_template?: string; relay?: { gateway_base_url?: string; jobs_poll_path?: string; jobs_start_path_template?: string; jobs_events_path_template?: string; jobs_result_path_template?: string; }; } export interface MswarmWorkerAgent extends MswarmCloudAgent { id?: string; remote_slug?: string; updated_at?: string; adapter?: string; source?: string; worker?: { installation_id?: string; status?: string; enabled?: boolean; name?: string; api_run_url?: string; docdex_enabled?: boolean; selected_agent?: Record | null; config_health?: Record; [key: string]: unknown; }; } export interface MswarmCloudAgentDetail extends MswarmCloudAgent { pricing?: Record; supported_parameters?: string[]; status?: string; moderation_status?: string; mcoda_shape?: Record; } export interface MswarmSelfHostedAgentDetail extends MswarmSelfHostedAgent, Omit { } export interface MswarmWorkerAgentDetail extends MswarmWorkerAgent, Omit { } export interface ListMswarmCloudAgentsOptions { provider?: string; limit?: number; maxCostPerMillion?: number; minContextWindow?: number; minReasoningRating?: number; sortByCatalogRating?: boolean; pruneMissing?: boolean; } export interface ListMswarmSelfHostedAgentsOptions extends ListMswarmCloudAgentsOptions { includeUnreachable?: boolean; includeLoadBalanced?: boolean; clientIdentity?: string; } export interface GetMswarmSelfHostedAgentOptions { includeLoadBalanced?: boolean; clientIdentity?: string; } export interface ListMswarmWorkerAgentsOptions extends ListMswarmCloudAgentsOptions { includeDisabled?: boolean; cursor?: string; updatedAfter?: string; } export interface MswarmWorkerCatalogPage { workers: MswarmWorkerAgent[]; next_cursor: string | null; generated_at?: string; total?: number; } export interface MswarmApiOptions { baseUrl?: string; openAiBaseUrl?: string; apiKey?: string; timeoutMs?: number; agentSlugPrefix?: string; selfHostedAgentSlugPrefix?: string; workerAgentSlugPrefix?: string; clientIdentity?: string; } export interface MswarmConsentResponse { consent_token: string; expires_in_seconds?: number; consent_types?: string[]; issued_at_ms?: number; client_id?: string; client_type?: string; tenant_id?: string; upload_signing_secret?: string; } export interface RegisterFreeMcodaClientOptions { clientId?: string; policyVersion?: string; productVersion: string; } export interface RequestMswarmDataDeletionInput { consentToken: string; product: string; clientId?: string; clientType?: string; reason?: string; } export interface MswarmDataDeletionResponse { accepted: boolean; request_id: number; product: string; client_id?: string; client_type?: string; tenant_id?: string; status: string; requested_at?: string; } interface ResolvedMswarmApiOptions { baseUrl: string; openAiBaseUrl?: string; apiKey?: string; timeoutMs: number; agentSlugPrefix: string; selfHostedAgentSlugPrefix: string; workerAgentSlugPrefix: string; clientIdentity?: string; } export interface ManagedMswarmCloudConfig { managed: true; remoteSlug: string; provider: string; modelId?: string; displayName?: string; description?: string; supportsReasoning?: boolean; pricingSnapshotId?: string; pricingVersion?: string; catalogBaseUrl: string; openAiBaseUrl: string; sync?: Record; syncedAt: string; } export interface ManagedMswarmAgentConfig extends Record { baseUrl: string; apiBaseUrl: string; mswarmCloud: ManagedMswarmCloudConfig; } export interface ManagedMswarmSelfHostedConfig { managed: true; remoteSlug: string; agentSlug: string; provider: string; routingMode?: 'direct' | 'auto'; loadBalanced?: boolean; loadBalancedGroupId?: string; selectorFingerprint?: string; memberCount?: number; adapter?: string; sourceAgentSlug?: string; nodeId?: string; serverName?: string; modelId?: string; publicModelId?: string; inputModalities?: GenerativeModality[]; outputModalities?: GenerativeModality[]; operations?: SelfHostedGenerativeOperation[]; displayName?: string; description?: string; supportsReasoning?: boolean; healthReason?: string; clientIdentity?: string; clientAllowlist?: MswarmSelfHostedNodeClientIdentity[]; clientAllowlistCount?: number; runtimePackageVersion?: string; relay?: { gatewayBaseUrl?: string; jobsPollPath?: string; jobsStartPathTemplate?: string; jobsEventsPathTemplate?: string; jobsResultPathTemplate?: string; }; lifecycle?: { compatible: boolean; reason?: string; missingRoutes?: string[]; checkedAt: string; }; catalogBaseUrl: string; openAiBaseUrl: string; sync?: Record; syncedAt: string; } export interface ManagedMswarmSelfHostedAgentConfig extends Record { baseUrl: string; apiBaseUrl: string; mswarmSelfHosted: ManagedMswarmSelfHostedConfig; } export interface ManagedMswarmWorkerConfig { managed: true; remoteSlug: string; workerId: string; provider: string; modelId?: string; displayName?: string; description?: string; catalogBaseUrl: string; apiRunUrl?: string; worker?: Record; sync?: Record; syncedAt: string; } export interface ManagedMswarmWorkerAgentConfig extends Record { baseUrl: string; apiBaseUrl: string; mswarmWorker: ManagedMswarmWorkerConfig; } export interface MswarmSyncRecord { remoteSlug: string; localSlug: string; action: 'created' | 'updated' | 'deleted'; provider: string; defaultModel: string; pricingVersion?: string; routingMode?: 'direct' | 'auto'; loadBalanced?: boolean; clientIdentity?: string; } export interface MswarmSyncSummary { created: number; updated: number; deleted: number; agents: MswarmSyncRecord[]; } export interface MswarmManagedAuthRefreshSummary { updated: number; agents: string[]; } export interface MswarmRuntimeUsageBudget { key: string; meter_id?: string | null; limit?: number | null; used?: number | null; remaining?: number | null; reset_at?: string | null; source?: string | null; [key: string]: unknown; } export interface MswarmRuntimeUsageLimits { product_slug: string | null; tenant_id: string | null; api_key_id: string | null; subscription_id: string | null; budgets: MswarmRuntimeUsageBudget[]; as_of: string | null; } export interface MswarmRuntimeIdentity { tenantId: string | null; productSlug: string | null; apiKeyId: string | null; subscriptionId: string | null; asOf: string | null; usageLimits: MswarmRuntimeUsageLimits; } export interface MswarmGenericNodeJobEnvelope { job_id: string; request_id: string; node_id: string; job: MswarmJobRequest; } export interface MswarmNodeAuthOptions { nodeBaseUrl?: string; token?: string; signingSecret?: string; tokenTtlSeconds?: number; } export interface MswarmCapabilityRequestOptions extends MswarmNodeAuthOptions { nodeId?: string; } export interface MswarmGenericJobOpsRequestOptions extends MswarmNodeAuthOptions { nodeId?: string; auditLimit?: number; auditOffset?: number; } export interface MswarmGenericJobReference extends MswarmNodeAuthOptions { jobId: string; nodeId?: string; requestId?: string; schemaVersion?: string; jobType?: MswarmJobType | string; } export interface MswarmGenericJobArtifactUploadInput extends MswarmGenericJobReference { name?: string; path: string; contentBase64: string; contentType?: string; sha256?: string; sizeBytes?: number; } export interface MswarmGenericJobArtifactUploadResult { job_id: string; artifact: MswarmArtifactRef; } export interface MswarmGenericJobEventsResult { job_id: string; events: MswarmJobEvent[]; } export interface MswarmGenericJobLogsResult { job_id: string; logs: MswarmGenericJobLogRecord[]; } export interface MswarmGenericJobArtifactsResult { job_id: string; artifacts: MswarmArtifactRef[]; } export interface MswarmGenericJobOpsJobSummary { job_id: string; request_id: string; tenant_id: string; node_id?: string; state: string; job_type: string; schema_version: string; priority: number; created_at: string; updated_at: string; queued_at?: string; scheduled_at?: string; started_at?: string; finished_at?: string; retry_count: number; max_retries: number; progress_percent?: number; last_event_type?: string; last_event_message?: string; artifact_count: number; artifact_bytes: number; log_bytes: number; } export interface MswarmGenericJobOpsSummary { schema_version: string; generated_at: string; node: { node_id: string; listen_host?: string; listen_port?: number; owner_local: boolean; generic_jobs_enabled: boolean; artifact_store_configured: boolean; max_concurrent_jobs: number; }; capabilities: Record; queue: { jobs: MswarmGenericJobOpsJobSummary[]; totals_by_state: Record; active_jobs: number; queued_jobs: number; terminal_jobs: number; }; quota: { max_concurrent_jobs: number; active_jobs: number; queued_jobs: number; available_slots: number; production_enforced: boolean; limits: Record; }; usage: { total_jobs: number; active_jobs: number; terminal_jobs: number; succeeded_jobs: number; failed_jobs: number; cancelled_jobs: number; blocked_jobs: number; expired_jobs: number; gpu_seconds: number; artifact_count: number; artifact_bytes: number; event_count: number; audit_event_count: number; stdout_bytes: number; stderr_bytes: number; log_bytes: number; }; audit: { total: number; offset: number; limit: number; events: MswarmGenericJobAuditEvent[]; }; } export interface MswarmGenericJobTokenInput { signingSecret: string; nodeId: string; jobId: string; requestId: string; schemaVersion: string; jobType: MswarmJobType | string; deadlineAt?: string; ttlSeconds?: number; allowedRunnerIds?: string[]; capabilityNames?: string[]; policyId?: string; policyVersion?: string; capabilityLeaseId?: string; capabilitySnapshotId?: string; } export interface MswarmCapabilityTokenInput { signingSecret: string; nodeId: string; deadlineAt?: string; ttlSeconds?: number; nonce?: string; } export type MswarmGenericJobOpsTokenInput = MswarmCapabilityTokenInput; export declare const MSWARM_CONSENT_POLICY_VERSION = "2026-03-18"; export declare const MCODA_FREE_CLIENT_TYPE = "free_mcoda_client"; export declare function signMswarmGenericJobToken(input: MswarmGenericJobTokenInput): string; export declare function signMswarmCapabilityToken(input: MswarmCapabilityTokenInput): string; export declare function signMswarmGenericJobOpsToken(input: MswarmGenericJobOpsTokenInput): string; export declare class MswarmApi { private readonly repo; private readonly options; readonly baseUrl: string; readonly agentSlugPrefix: string; readonly selfHostedAgentSlugPrefix: string; readonly workerAgentSlugPrefix: string; constructor(repo: GlobalRepository, options: ResolvedMswarmApiOptions); static create(options?: MswarmApiOptions): Promise; static refreshManagedAgentAuth(apiKey: string): Promise; close(): Promise; refreshManagedAgentAuth(): Promise; getRuntimeUsageLimits(): Promise; getRuntimeIdentity(): Promise; private nodeBaseUrl; private genericJobToken; private capabilityToken; private genericJobOpsToken; private referenceFromJob; listGpuCapabilities(options?: MswarmCapabilityRequestOptions): Promise>; getGenericJobOps(options?: MswarmGenericJobOpsRequestOptions): Promise; uploadGenericJobArtifact(input: MswarmGenericJobArtifactUploadInput): Promise; runGenericJob(job: MswarmGenericNodeJobEnvelope, options?: MswarmNodeAuthOptions): Promise; getGenericJob(input: MswarmGenericJobReference): Promise; getGenericJobEvents(input: MswarmGenericJobReference): Promise; getGenericJobLogs(input: MswarmGenericJobReference): Promise; getGenericJobArtifacts(input: MswarmGenericJobReference): Promise; cancelGenericJob(input: MswarmGenericJobReference): Promise; retryGenericJob(input: MswarmGenericJobReference): Promise; private requireApiKey; private requestJson; listCloudAgents(options?: ListMswarmCloudAgentsOptions): Promise; getCloudAgent(slug: string): Promise; listSelfHostedAgents(options?: ListMswarmSelfHostedAgentsOptions): Promise; getSelfHostedAgent(slug: string, options?: GetMswarmSelfHostedAgentOptions): Promise; private listWorkerAgentPage; listAllWorkers(options?: ListMswarmWorkerAgentsOptions): Promise; listWorkers(options?: ListMswarmWorkerAgentsOptions): Promise; getWorker(slug: string): Promise; runWorker(slug: string, payload: unknown, options?: { idempotencyKey?: string; }): Promise>; syncCloudAgents(options?: ListMswarmCloudAgentsOptions): Promise; syncSelfHostedAgents(options?: ListMswarmSelfHostedAgentsOptions): Promise; syncWorkers(options?: ListMswarmWorkerAgentsOptions): Promise; issuePaidConsent(policyVersion?: string): Promise; registerFreeMcodaClient(options: RegisterFreeMcodaClientOptions): Promise; revokeConsent(consentToken: string, reason?: string): Promise<{ revoked: boolean; revoked_at_ms?: number; }>; requestDataDeletion(input: RequestMswarmDataDeletionInput): Promise; } //# sourceMappingURL=MswarmApi.d.ts.map