pybao-xc-sdk 1.5.53 → 1.5.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,3 +15,7 @@ pybao-xc-sdk is an SDK for integrating with PYB server capabilities across Web,
15
15
  - Custom frontend console integration with PYB
16
16
  - Electron desktop applications powered by PYB
17
17
  - Middleware services orchestrating PYB capabilities
18
+
19
+ ## Facade Example
20
+
21
+ - `client.session.create(...)`
package/dist/index.d.mts CHANGED
@@ -2259,6 +2259,89 @@ interface SessionInfo {
2259
2259
  agent: string;
2260
2260
  };
2261
2261
  }
2262
+ interface ProviderRef {
2263
+ providerID: string;
2264
+ displayName: string;
2265
+ connected: boolean;
2266
+ }
2267
+ interface ModelRef {
2268
+ providerID: string;
2269
+ modelID: string;
2270
+ displayName: string;
2271
+ capabilities: string[];
2272
+ }
2273
+ interface ProviderAuthMethod {
2274
+ providerID: string;
2275
+ type: 'oauth' | 'api';
2276
+ label: string;
2277
+ scopes: string[];
2278
+ }
2279
+ interface ProviderListResponse {
2280
+ all: ProviderRef[];
2281
+ default: ModelRef | null;
2282
+ connected: string[];
2283
+ }
2284
+ interface ProviderOAuthAuthorizeRequest {
2285
+ redirectUri?: string;
2286
+ scope?: string;
2287
+ }
2288
+ interface ProviderOAuthAuthorizeResponse {
2289
+ providerID: string;
2290
+ authorizationUrl: string;
2291
+ state: string;
2292
+ codeChallengeMethod: 'S256';
2293
+ }
2294
+ interface ProviderOAuthCallbackRequest {
2295
+ code: string;
2296
+ state: string;
2297
+ }
2298
+ interface ProviderOAuthCallbackResponse {
2299
+ providerID: string;
2300
+ connected: boolean;
2301
+ method: 'oauth';
2302
+ }
2303
+ interface AuthSetRequest {
2304
+ apiKey: string;
2305
+ }
2306
+ interface AuthSetResponse {
2307
+ providerID: string;
2308
+ connected: boolean;
2309
+ method: 'api';
2310
+ }
2311
+ interface AuthRemoveResponse {
2312
+ providerID: string;
2313
+ removed: boolean;
2314
+ }
2315
+ interface SetDefaultModelRequest {
2316
+ providerID: string;
2317
+ modelID: string;
2318
+ scope?: 'global' | 'workspace';
2319
+ }
2320
+ interface SetDefaultModelResponse {
2321
+ scope: 'global';
2322
+ requestedScope: 'global' | 'workspace';
2323
+ applied: boolean;
2324
+ fallbackReason: string | null;
2325
+ current: ModelRef;
2326
+ }
2327
+ interface ModelPoolSourceRecord {
2328
+ pluginSpec: string;
2329
+ pluginID: string;
2330
+ sourceID: string;
2331
+ sourceType: 'marketplace' | 'github' | 'npm' | 'local';
2332
+ }
2333
+ interface ModelPoolStatusItem {
2334
+ modelPoolID: string;
2335
+ state: 'registered' | 'active' | 'inactive';
2336
+ pluginCount: number;
2337
+ sourceRecords: ModelPoolSourceRecord[];
2338
+ metadata: Record<string, string>;
2339
+ }
2340
+ interface ModelPoolStatusResponse {
2341
+ total: number;
2342
+ active: number;
2343
+ pools: ModelPoolStatusItem[];
2344
+ }
2262
2345
  interface CreateSessionRequest {
2263
2346
  resumeFrom?: string;
2264
2347
  config?: {
@@ -2399,6 +2482,25 @@ declare class PybClient {
2399
2482
  get: () => Promise<unknown>;
2400
2483
  update: (config: Record<string, unknown>) => Promise<unknown>;
2401
2484
  };
2485
+ readonly provider: {
2486
+ list: () => Promise<ProviderListResponse>;
2487
+ authMethods: () => Promise<ProviderAuthMethod[]>;
2488
+ oauth: {
2489
+ authorize: (providerID: string, request?: ProviderOAuthAuthorizeRequest) => Promise<ProviderOAuthAuthorizeResponse>;
2490
+ callback: (providerID: string, request: ProviderOAuthCallbackRequest) => Promise<ProviderOAuthCallbackResponse>;
2491
+ };
2492
+ };
2493
+ readonly model: {
2494
+ getDefault: () => Promise<ModelRef | null>;
2495
+ setDefault: (request: SetDefaultModelRequest) => Promise<SetDefaultModelResponse>;
2496
+ };
2497
+ readonly auth: {
2498
+ set: (providerID: string, request: AuthSetRequest) => Promise<AuthSetResponse>;
2499
+ remove: (providerID: string) => Promise<AuthRemoveResponse>;
2500
+ };
2501
+ readonly modelPool: {
2502
+ status: () => Promise<ModelPoolStatusResponse>;
2503
+ };
2402
2504
  constructor(config?: PybClientConfig);
2403
2505
  getHealth(): Promise<HealthResponse>;
2404
2506
  private createSessionRequest;
@@ -2418,6 +2520,15 @@ declare class PybClient {
2418
2520
  private executeToolRequest;
2419
2521
  private getConfigRequest;
2420
2522
  private updateConfigRequest;
2523
+ private getProvidersRequest;
2524
+ private getProviderAuthMethodsRequest;
2525
+ private authorizeProviderOAuthRequest;
2526
+ private callbackProviderOAuthRequest;
2527
+ private getDefaultModelRequest;
2528
+ private setDefaultModelRequest;
2529
+ private setProviderAuthRequest;
2530
+ private removeProviderAuthRequest;
2531
+ private getModelPoolStatusRequest;
2421
2532
  private listMCPServersRequest;
2422
2533
  private connectMCPServerRequest;
2423
2534
  private disconnectMCPServerRequest;
@@ -3253,6 +3364,143 @@ declare function resolveDefaultBackendFromEnv(input?: {
3253
3364
  routeSource: SessionBackendRouteSource;
3254
3365
  };
3255
3366
 
3367
+ type OpenworkFieldMapping = {
3368
+ openworkField: string;
3369
+ pybField: string;
3370
+ };
3371
+ type OpenworkEndpointMapping = {
3372
+ openworkEndpoint: string;
3373
+ pybEndpoint: string;
3374
+ };
3375
+ type OpenworkErrorMapping = {
3376
+ openworkErrorCode: string;
3377
+ pybErrorCode: string;
3378
+ };
3379
+ type OpenworkMigrationMap = {
3380
+ fieldMappings: OpenworkFieldMapping[];
3381
+ endpointMappings: OpenworkEndpointMapping[];
3382
+ errorMappings: OpenworkErrorMapping[];
3383
+ };
3384
+ type OpenworkMigrationMapV2 = OpenworkMigrationMap & {
3385
+ version: 'v2';
3386
+ };
3387
+ type OpenworkCompatibilitySampleInput = {
3388
+ providerID: string;
3389
+ modelID: string;
3390
+ apiKey: string;
3391
+ scope?: 'global' | 'workspace';
3392
+ };
3393
+ type OpenworkProviderPickerSample = {
3394
+ providers: Array<{
3395
+ id: string;
3396
+ label: string;
3397
+ connected: boolean;
3398
+ isDefault: boolean;
3399
+ }>;
3400
+ };
3401
+ type OpenworkAuthModalSample = {
3402
+ providerID: string;
3403
+ method: 'api';
3404
+ connected: boolean;
3405
+ };
3406
+ type OpenworkModelSetSample = {
3407
+ scope: 'global';
3408
+ fallbackReason: string | null;
3409
+ current: ModelRef;
3410
+ };
3411
+ type OpenworkGoNoGoResult = {
3412
+ decision: 'go' | 'no-go';
3413
+ reasons: string[];
3414
+ rollbackPlan: string[];
3415
+ };
3416
+ type OpenworkCompatibilitySampleResult = {
3417
+ providerPicker: OpenworkProviderPickerSample;
3418
+ authModal: OpenworkAuthModalSample;
3419
+ modelSet: OpenworkModelSetSample;
3420
+ modelPoolStatus: ModelPoolStatusResponse;
3421
+ compatibilityScore: number;
3422
+ goNoGo: OpenworkGoNoGoResult;
3423
+ };
3424
+ type ProviderFacadeEnvironment = 'internal' | 'beta' | 'production';
3425
+ type ProviderFacadeFeatureFlag = {
3426
+ enabled: boolean;
3427
+ environment: ProviderFacadeEnvironment;
3428
+ workspaceAllowlist: string[];
3429
+ };
3430
+ type CompatibilityWindowPolicy = {
3431
+ minorVersions: number;
3432
+ deprecatedEndpoints: string[];
3433
+ };
3434
+ type ProviderFacadeReleaseState = {
3435
+ featureFlag: ProviderFacadeFeatureFlag;
3436
+ compatibilityWindow: CompatibilityWindowPolicy;
3437
+ };
3438
+ type ProviderFacadeRolloutInput = {
3439
+ p0IncidentCount: number;
3440
+ rollbackSwitchLatencyMs: number;
3441
+ fallbackReasonDistribution: Record<string, number>;
3442
+ authFailureRate: number;
3443
+ compatibilityMinorVersions: number;
3444
+ };
3445
+ type ProviderFacadeRolloutResult = {
3446
+ decision: 'go' | 'no-go';
3447
+ reasons: string[];
3448
+ };
3449
+ type ProviderFacadeAccessInput = {
3450
+ workspaceID: string;
3451
+ };
3452
+ type ProviderFacadeAccessResult = {
3453
+ allowed: boolean;
3454
+ reason?: 'feature_disabled' | 'workspace_not_allowlisted';
3455
+ };
3456
+ type ProviderFacadeDeprecationChecklist = {
3457
+ compatibilityMinorVersions: number;
3458
+ deprecatedEndpoints: string[];
3459
+ readyForRetirement: boolean;
3460
+ };
3461
+ type ModelPlatformDebtSeverity = 'D0' | 'D1' | 'D2';
3462
+ type ModelPlatformDebtStatus = 'open' | 'closed';
3463
+ type ModelPlatformDebtItem = {
3464
+ id: string;
3465
+ title: string;
3466
+ severity: ModelPlatformDebtSeverity;
3467
+ owner: string;
3468
+ batch: string;
3469
+ status: ModelPlatformDebtStatus;
3470
+ };
3471
+ type ModelPlatformAuditEvidence = {
3472
+ testsPassed: boolean;
3473
+ lintPassed: boolean;
3474
+ typecheckPassed: boolean;
3475
+ rollbackDrillPassed: boolean;
3476
+ };
3477
+ type ModelPlatformDebtCloseoutInput = {
3478
+ debts: ModelPlatformDebtItem[];
3479
+ auditEvidence: ModelPlatformAuditEvidence;
3480
+ };
3481
+ type ModelPlatformDebtCloseoutSummary = {
3482
+ openD0: number;
3483
+ openD1: number;
3484
+ openD2: number;
3485
+ invalidBatchOwnershipCount: number;
3486
+ evidenceCompleteness: number;
3487
+ };
3488
+ type ModelPlatformDebtCloseoutResult = {
3489
+ decision: 'go' | 'no-go';
3490
+ reasonCodes: string[];
3491
+ summary: ModelPlatformDebtCloseoutSummary;
3492
+ riskStatement: string;
3493
+ };
3494
+ declare function getProviderFacadeReleaseState(): ProviderFacadeReleaseState;
3495
+ declare function setProviderFacadeReleaseState(input: Partial<ProviderFacadeReleaseState>): ProviderFacadeReleaseState;
3496
+ declare function evaluateProviderFacadeRollout(input: ProviderFacadeRolloutInput): ProviderFacadeRolloutResult;
3497
+ declare function evaluateProviderFacadeAccess(input: ProviderFacadeAccessInput): ProviderFacadeAccessResult;
3498
+ declare function getProviderFacadeDeprecationChecklist(): ProviderFacadeDeprecationChecklist;
3499
+ declare function evaluateModelPlatformDebtCloseout(input: ModelPlatformDebtCloseoutInput): ModelPlatformDebtCloseoutResult;
3500
+ declare function getOpenworkMigrationMap(): OpenworkMigrationMap;
3501
+ declare function getOpenworkMigrationMapV2(): OpenworkMigrationMapV2;
3502
+ declare function runOpenworkCompatibilitySample(client: PybClient, input: OpenworkCompatibilitySampleInput): Promise<OpenworkCompatibilitySampleResult>;
3503
+
3256
3504
  /**
3257
3505
  * @pyb/sdk - PYB-CLI Server SDK
3258
3506
  *
@@ -3261,4 +3509,4 @@ declare function resolveDefaultBackendFromEnv(input?: {
3261
3509
 
3262
3510
  declare const SDK_VERSION = "0.1.0";
3263
3511
 
3264
- export { type APIError, type Attachment, type BackendKind, BackendKindSchema, type CanUseToolCallback, type CanUseToolDecision, type ContentBlock, ContentBlockSchema, type CreateSessionRequest, type CreateSessionResponse, DEFAULT_SESSION_BACKEND_ROUTER_CONFIG, type DualTrackMetrics, DualTrackMetricsSchema, type DualTrackRawStats, DualTrackRawStatsSchema, type DualTrackThresholds, DualTrackThresholdsSchema, type ErrorEvent, ErrorEventSchema, type ErrorStreamEvent, ErrorStreamEventSchema, FALLBACK_TRIGGER_MATRIX, type FallbackTriggerReason, FallbackTriggerReasonSchema, type HealthResponse, type Message, type MessageCompletedEvent, MessageCompletedEventSchema, type MessageCreatedEvent, MessageCreatedEventSchema, MessageSchema, type MessageUpdatedEvent, MessageUpdatedEventSchema, PROTOCOL_ERROR_TO_RUNTIME_ERROR_TYPE, type PermissionEvaluator, type PermissionMode, type PermissionRequestedEvent, PermissionRequestedEventSchema, type PermissionRespondedEvent, PermissionRespondedEventSchema, type PermissionResponseRequest, type PermissionTimeoutEvent, PermissionTimeoutEventSchema, type PromptRequest, type PromptResponse, type ProtocolErrorCode, ProtocolErrorCodeSchema, type ProtocolErrorMapping, ProtocolErrorMappingSchema, type ProtocolSessionStreamBinding, ProtocolSessionStreamBindingManager, PybClient, type PybSSEEvent, PybSSEEventSchema, type QuerySessionExecutor, type RequestCompletedEvent, RequestCompletedEventSchema, type RequestStartedEvent, RequestStartedEventSchema, type ResolvePermissionDecisionInput, type RuntimeBackendErrorPhase, type RuntimeCompatibleLegacyEvent, type RuntimeEvent, type RuntimeEventDomain, RuntimeEventDomainSchema, type RuntimeEventErrorType, RuntimeEventErrorTypeSchema, RuntimeEventSchema, type RuntimePermissionPolicy, type RuntimeSession, type RuntimeSessionConfig, type RuntimeSessionEvent, RuntimeSessionEventSchema, type RuntimeSessionInput, RuntimeSessionInputSchema, type RuntimeSessionStatus, RuntimeSessionStatusSchema, S4_PROTOCOL_ERROR_TOP_CODES, S5_A0_EQUIVALENCE_SAMPLE_SET, SDK_VERSION, SESSION_BACKEND_CONFIG_CONTRACT_VERSION, SESSION_BACKEND_ENV_KEY, SESSION_BACKEND_OBSERVABILITY_SPEC, SSEClient, type SSEDedupEvent, SSEDedupEventSchema, type SSEEvent, type SSEReplayEvent, SSEReplayEventSchema, type SSEReplayGapEvent, SSEReplayGapEventSchema, type ServerConnectedEvent, ServerConnectedEventSchema, type ServerHeartbeatEvent, ServerHeartbeatEventSchema, type ServerStatusEvent, ServerStatusEventSchema, type SessionBackend, type SessionBackendRouteSource, type SessionBackendRouterConfig, SessionBackendRouterConfigSchema, type SessionBackendSession, type SessionBackendUserConfig, type SessionCreatedEvent, SessionCreatedEventSchema, type SessionDeletedEvent, SessionDeletedEventSchema, type SessionEventPublisher, type SessionInfo, type SessionUpdatedEvent, SessionUpdatedEventSchema, type ToolCompletedEvent, ToolCompletedEventSchema, type ToolErrorEvent, ToolErrorEventSchema, type ToolInfo, type ToolPermissionContext, type ToolProgressEvent, ToolProgressEventSchema, type ToolResolver, type ToolStartedEvent, ToolStartedEventSchema, type V2Message, V2MessageSchema, V2RequestStatusSchema, type V2Session, V2SessionSchema, type V2SessionStatus, V2SessionStatusSchema, type V2ToolUseContext, V2ToolUseContextSchema, buildDefaultDualTrackThresholds, buildV2ToolUseContextFromPromptRequest, canTransitionV2SessionStatus, createDefaultToolPermissionContextForSdk, createProtocolSessionBackend, createRuntimePermissionContextForSession, createRuntimeSession, createRuntimeSessionBackend, createSSEClient, createSessionBackendRouter, emitBackendConfigWarning, evaluateDualTrackMetrics, evaluateV1DeprecationReadiness, getRuntimeEventMappingRules, isToolAutoExecutableInContext, mapProtocolErrorCodeToRuntimeErrorType, mapRuntimeBackendErrorToRuntimeEvent, mapRuntimeMessageToV2, mapRuntimeSessionStatusToV2, mapV1MessageToV2, mapV1SessionStatusToV2, projectLegacyEventToRuntimeEvent, projectRuntimeEventToLegacyEvent, resolveDefaultBackend, resolveDefaultBackendFromEnv, resolvePermissionDecision, resolvePermissionModeForSdk, resolveRouterBackendKind, shouldTriggerFallback, validateV2Message, validateV2Session, validateV2ToolUseContext };
3512
+ export { type APIError, type Attachment, type AuthRemoveResponse, type AuthSetRequest, type AuthSetResponse, type BackendKind, BackendKindSchema, type CanUseToolCallback, type CanUseToolDecision, type CompatibilityWindowPolicy, type ContentBlock, ContentBlockSchema, type CreateSessionRequest, type CreateSessionResponse, DEFAULT_SESSION_BACKEND_ROUTER_CONFIG, type DualTrackMetrics, DualTrackMetricsSchema, type DualTrackRawStats, DualTrackRawStatsSchema, type DualTrackThresholds, DualTrackThresholdsSchema, type ErrorEvent, ErrorEventSchema, type ErrorStreamEvent, ErrorStreamEventSchema, FALLBACK_TRIGGER_MATRIX, type FallbackTriggerReason, FallbackTriggerReasonSchema, type HealthResponse, type Message, type MessageCompletedEvent, MessageCompletedEventSchema, type MessageCreatedEvent, MessageCreatedEventSchema, MessageSchema, type MessageUpdatedEvent, MessageUpdatedEventSchema, type ModelPlatformAuditEvidence, type ModelPlatformDebtCloseoutInput, type ModelPlatformDebtCloseoutResult, type ModelPlatformDebtCloseoutSummary, type ModelPlatformDebtItem, type ModelPlatformDebtSeverity, type ModelPlatformDebtStatus, type ModelPoolSourceRecord, type ModelPoolStatusItem, type ModelPoolStatusResponse, type ModelRef, type OpenworkAuthModalSample, type OpenworkCompatibilitySampleInput, type OpenworkCompatibilitySampleResult, type OpenworkEndpointMapping, type OpenworkErrorMapping, type OpenworkFieldMapping, type OpenworkGoNoGoResult, type OpenworkMigrationMap, type OpenworkMigrationMapV2, type OpenworkModelSetSample, type OpenworkProviderPickerSample, PROTOCOL_ERROR_TO_RUNTIME_ERROR_TYPE, type PermissionEvaluator, type PermissionMode, type PermissionRequestedEvent, PermissionRequestedEventSchema, type PermissionRespondedEvent, PermissionRespondedEventSchema, type PermissionResponseRequest, type PermissionTimeoutEvent, PermissionTimeoutEventSchema, type PromptRequest, type PromptResponse, type ProtocolErrorCode, ProtocolErrorCodeSchema, type ProtocolErrorMapping, ProtocolErrorMappingSchema, type ProtocolSessionStreamBinding, ProtocolSessionStreamBindingManager, type ProviderAuthMethod, type ProviderFacadeAccessInput, type ProviderFacadeAccessResult, type ProviderFacadeDeprecationChecklist, type ProviderFacadeEnvironment, type ProviderFacadeFeatureFlag, type ProviderFacadeReleaseState, type ProviderFacadeRolloutInput, type ProviderFacadeRolloutResult, type ProviderListResponse, type ProviderOAuthAuthorizeRequest, type ProviderOAuthAuthorizeResponse, type ProviderOAuthCallbackRequest, type ProviderOAuthCallbackResponse, type ProviderRef, PybClient, type PybSSEEvent, PybSSEEventSchema, type QuerySessionExecutor, type RequestCompletedEvent, RequestCompletedEventSchema, type RequestStartedEvent, RequestStartedEventSchema, type ResolvePermissionDecisionInput, type RuntimeBackendErrorPhase, type RuntimeCompatibleLegacyEvent, type RuntimeEvent, type RuntimeEventDomain, RuntimeEventDomainSchema, type RuntimeEventErrorType, RuntimeEventErrorTypeSchema, RuntimeEventSchema, type RuntimePermissionPolicy, type RuntimeSession, type RuntimeSessionConfig, type RuntimeSessionEvent, RuntimeSessionEventSchema, type RuntimeSessionInput, RuntimeSessionInputSchema, type RuntimeSessionStatus, RuntimeSessionStatusSchema, S4_PROTOCOL_ERROR_TOP_CODES, S5_A0_EQUIVALENCE_SAMPLE_SET, SDK_VERSION, SESSION_BACKEND_CONFIG_CONTRACT_VERSION, SESSION_BACKEND_ENV_KEY, SESSION_BACKEND_OBSERVABILITY_SPEC, SSEClient, type SSEDedupEvent, SSEDedupEventSchema, type SSEEvent, type SSEReplayEvent, SSEReplayEventSchema, type SSEReplayGapEvent, SSEReplayGapEventSchema, type ServerConnectedEvent, ServerConnectedEventSchema, type ServerHeartbeatEvent, ServerHeartbeatEventSchema, type ServerStatusEvent, ServerStatusEventSchema, type SessionBackend, type SessionBackendRouteSource, type SessionBackendRouterConfig, SessionBackendRouterConfigSchema, type SessionBackendSession, type SessionBackendUserConfig, type SessionCreatedEvent, SessionCreatedEventSchema, type SessionDeletedEvent, SessionDeletedEventSchema, type SessionEventPublisher, type SessionInfo, type SessionUpdatedEvent, SessionUpdatedEventSchema, type SetDefaultModelRequest, type SetDefaultModelResponse, type ToolCompletedEvent, ToolCompletedEventSchema, type ToolErrorEvent, ToolErrorEventSchema, type ToolInfo, type ToolPermissionContext, type ToolProgressEvent, ToolProgressEventSchema, type ToolResolver, type ToolStartedEvent, ToolStartedEventSchema, type V2Message, V2MessageSchema, V2RequestStatusSchema, type V2Session, V2SessionSchema, type V2SessionStatus, V2SessionStatusSchema, type V2ToolUseContext, V2ToolUseContextSchema, buildDefaultDualTrackThresholds, buildV2ToolUseContextFromPromptRequest, canTransitionV2SessionStatus, createDefaultToolPermissionContextForSdk, createProtocolSessionBackend, createRuntimePermissionContextForSession, createRuntimeSession, createRuntimeSessionBackend, createSSEClient, createSessionBackendRouter, emitBackendConfigWarning, evaluateDualTrackMetrics, evaluateModelPlatformDebtCloseout, evaluateProviderFacadeAccess, evaluateProviderFacadeRollout, evaluateV1DeprecationReadiness, getOpenworkMigrationMap, getOpenworkMigrationMapV2, getProviderFacadeDeprecationChecklist, getProviderFacadeReleaseState, getRuntimeEventMappingRules, isToolAutoExecutableInContext, mapProtocolErrorCodeToRuntimeErrorType, mapRuntimeBackendErrorToRuntimeEvent, mapRuntimeMessageToV2, mapRuntimeSessionStatusToV2, mapV1MessageToV2, mapV1SessionStatusToV2, projectLegacyEventToRuntimeEvent, projectRuntimeEventToLegacyEvent, resolveDefaultBackend, resolveDefaultBackendFromEnv, resolvePermissionDecision, resolvePermissionModeForSdk, resolveRouterBackendKind, runOpenworkCompatibilitySample, setProviderFacadeReleaseState, shouldTriggerFallback, validateV2Message, validateV2Session, validateV2ToolUseContext };
package/dist/index.d.ts CHANGED
@@ -2259,6 +2259,89 @@ interface SessionInfo {
2259
2259
  agent: string;
2260
2260
  };
2261
2261
  }
2262
+ interface ProviderRef {
2263
+ providerID: string;
2264
+ displayName: string;
2265
+ connected: boolean;
2266
+ }
2267
+ interface ModelRef {
2268
+ providerID: string;
2269
+ modelID: string;
2270
+ displayName: string;
2271
+ capabilities: string[];
2272
+ }
2273
+ interface ProviderAuthMethod {
2274
+ providerID: string;
2275
+ type: 'oauth' | 'api';
2276
+ label: string;
2277
+ scopes: string[];
2278
+ }
2279
+ interface ProviderListResponse {
2280
+ all: ProviderRef[];
2281
+ default: ModelRef | null;
2282
+ connected: string[];
2283
+ }
2284
+ interface ProviderOAuthAuthorizeRequest {
2285
+ redirectUri?: string;
2286
+ scope?: string;
2287
+ }
2288
+ interface ProviderOAuthAuthorizeResponse {
2289
+ providerID: string;
2290
+ authorizationUrl: string;
2291
+ state: string;
2292
+ codeChallengeMethod: 'S256';
2293
+ }
2294
+ interface ProviderOAuthCallbackRequest {
2295
+ code: string;
2296
+ state: string;
2297
+ }
2298
+ interface ProviderOAuthCallbackResponse {
2299
+ providerID: string;
2300
+ connected: boolean;
2301
+ method: 'oauth';
2302
+ }
2303
+ interface AuthSetRequest {
2304
+ apiKey: string;
2305
+ }
2306
+ interface AuthSetResponse {
2307
+ providerID: string;
2308
+ connected: boolean;
2309
+ method: 'api';
2310
+ }
2311
+ interface AuthRemoveResponse {
2312
+ providerID: string;
2313
+ removed: boolean;
2314
+ }
2315
+ interface SetDefaultModelRequest {
2316
+ providerID: string;
2317
+ modelID: string;
2318
+ scope?: 'global' | 'workspace';
2319
+ }
2320
+ interface SetDefaultModelResponse {
2321
+ scope: 'global';
2322
+ requestedScope: 'global' | 'workspace';
2323
+ applied: boolean;
2324
+ fallbackReason: string | null;
2325
+ current: ModelRef;
2326
+ }
2327
+ interface ModelPoolSourceRecord {
2328
+ pluginSpec: string;
2329
+ pluginID: string;
2330
+ sourceID: string;
2331
+ sourceType: 'marketplace' | 'github' | 'npm' | 'local';
2332
+ }
2333
+ interface ModelPoolStatusItem {
2334
+ modelPoolID: string;
2335
+ state: 'registered' | 'active' | 'inactive';
2336
+ pluginCount: number;
2337
+ sourceRecords: ModelPoolSourceRecord[];
2338
+ metadata: Record<string, string>;
2339
+ }
2340
+ interface ModelPoolStatusResponse {
2341
+ total: number;
2342
+ active: number;
2343
+ pools: ModelPoolStatusItem[];
2344
+ }
2262
2345
  interface CreateSessionRequest {
2263
2346
  resumeFrom?: string;
2264
2347
  config?: {
@@ -2399,6 +2482,25 @@ declare class PybClient {
2399
2482
  get: () => Promise<unknown>;
2400
2483
  update: (config: Record<string, unknown>) => Promise<unknown>;
2401
2484
  };
2485
+ readonly provider: {
2486
+ list: () => Promise<ProviderListResponse>;
2487
+ authMethods: () => Promise<ProviderAuthMethod[]>;
2488
+ oauth: {
2489
+ authorize: (providerID: string, request?: ProviderOAuthAuthorizeRequest) => Promise<ProviderOAuthAuthorizeResponse>;
2490
+ callback: (providerID: string, request: ProviderOAuthCallbackRequest) => Promise<ProviderOAuthCallbackResponse>;
2491
+ };
2492
+ };
2493
+ readonly model: {
2494
+ getDefault: () => Promise<ModelRef | null>;
2495
+ setDefault: (request: SetDefaultModelRequest) => Promise<SetDefaultModelResponse>;
2496
+ };
2497
+ readonly auth: {
2498
+ set: (providerID: string, request: AuthSetRequest) => Promise<AuthSetResponse>;
2499
+ remove: (providerID: string) => Promise<AuthRemoveResponse>;
2500
+ };
2501
+ readonly modelPool: {
2502
+ status: () => Promise<ModelPoolStatusResponse>;
2503
+ };
2402
2504
  constructor(config?: PybClientConfig);
2403
2505
  getHealth(): Promise<HealthResponse>;
2404
2506
  private createSessionRequest;
@@ -2418,6 +2520,15 @@ declare class PybClient {
2418
2520
  private executeToolRequest;
2419
2521
  private getConfigRequest;
2420
2522
  private updateConfigRequest;
2523
+ private getProvidersRequest;
2524
+ private getProviderAuthMethodsRequest;
2525
+ private authorizeProviderOAuthRequest;
2526
+ private callbackProviderOAuthRequest;
2527
+ private getDefaultModelRequest;
2528
+ private setDefaultModelRequest;
2529
+ private setProviderAuthRequest;
2530
+ private removeProviderAuthRequest;
2531
+ private getModelPoolStatusRequest;
2421
2532
  private listMCPServersRequest;
2422
2533
  private connectMCPServerRequest;
2423
2534
  private disconnectMCPServerRequest;
@@ -3253,6 +3364,143 @@ declare function resolveDefaultBackendFromEnv(input?: {
3253
3364
  routeSource: SessionBackendRouteSource;
3254
3365
  };
3255
3366
 
3367
+ type OpenworkFieldMapping = {
3368
+ openworkField: string;
3369
+ pybField: string;
3370
+ };
3371
+ type OpenworkEndpointMapping = {
3372
+ openworkEndpoint: string;
3373
+ pybEndpoint: string;
3374
+ };
3375
+ type OpenworkErrorMapping = {
3376
+ openworkErrorCode: string;
3377
+ pybErrorCode: string;
3378
+ };
3379
+ type OpenworkMigrationMap = {
3380
+ fieldMappings: OpenworkFieldMapping[];
3381
+ endpointMappings: OpenworkEndpointMapping[];
3382
+ errorMappings: OpenworkErrorMapping[];
3383
+ };
3384
+ type OpenworkMigrationMapV2 = OpenworkMigrationMap & {
3385
+ version: 'v2';
3386
+ };
3387
+ type OpenworkCompatibilitySampleInput = {
3388
+ providerID: string;
3389
+ modelID: string;
3390
+ apiKey: string;
3391
+ scope?: 'global' | 'workspace';
3392
+ };
3393
+ type OpenworkProviderPickerSample = {
3394
+ providers: Array<{
3395
+ id: string;
3396
+ label: string;
3397
+ connected: boolean;
3398
+ isDefault: boolean;
3399
+ }>;
3400
+ };
3401
+ type OpenworkAuthModalSample = {
3402
+ providerID: string;
3403
+ method: 'api';
3404
+ connected: boolean;
3405
+ };
3406
+ type OpenworkModelSetSample = {
3407
+ scope: 'global';
3408
+ fallbackReason: string | null;
3409
+ current: ModelRef;
3410
+ };
3411
+ type OpenworkGoNoGoResult = {
3412
+ decision: 'go' | 'no-go';
3413
+ reasons: string[];
3414
+ rollbackPlan: string[];
3415
+ };
3416
+ type OpenworkCompatibilitySampleResult = {
3417
+ providerPicker: OpenworkProviderPickerSample;
3418
+ authModal: OpenworkAuthModalSample;
3419
+ modelSet: OpenworkModelSetSample;
3420
+ modelPoolStatus: ModelPoolStatusResponse;
3421
+ compatibilityScore: number;
3422
+ goNoGo: OpenworkGoNoGoResult;
3423
+ };
3424
+ type ProviderFacadeEnvironment = 'internal' | 'beta' | 'production';
3425
+ type ProviderFacadeFeatureFlag = {
3426
+ enabled: boolean;
3427
+ environment: ProviderFacadeEnvironment;
3428
+ workspaceAllowlist: string[];
3429
+ };
3430
+ type CompatibilityWindowPolicy = {
3431
+ minorVersions: number;
3432
+ deprecatedEndpoints: string[];
3433
+ };
3434
+ type ProviderFacadeReleaseState = {
3435
+ featureFlag: ProviderFacadeFeatureFlag;
3436
+ compatibilityWindow: CompatibilityWindowPolicy;
3437
+ };
3438
+ type ProviderFacadeRolloutInput = {
3439
+ p0IncidentCount: number;
3440
+ rollbackSwitchLatencyMs: number;
3441
+ fallbackReasonDistribution: Record<string, number>;
3442
+ authFailureRate: number;
3443
+ compatibilityMinorVersions: number;
3444
+ };
3445
+ type ProviderFacadeRolloutResult = {
3446
+ decision: 'go' | 'no-go';
3447
+ reasons: string[];
3448
+ };
3449
+ type ProviderFacadeAccessInput = {
3450
+ workspaceID: string;
3451
+ };
3452
+ type ProviderFacadeAccessResult = {
3453
+ allowed: boolean;
3454
+ reason?: 'feature_disabled' | 'workspace_not_allowlisted';
3455
+ };
3456
+ type ProviderFacadeDeprecationChecklist = {
3457
+ compatibilityMinorVersions: number;
3458
+ deprecatedEndpoints: string[];
3459
+ readyForRetirement: boolean;
3460
+ };
3461
+ type ModelPlatformDebtSeverity = 'D0' | 'D1' | 'D2';
3462
+ type ModelPlatformDebtStatus = 'open' | 'closed';
3463
+ type ModelPlatformDebtItem = {
3464
+ id: string;
3465
+ title: string;
3466
+ severity: ModelPlatformDebtSeverity;
3467
+ owner: string;
3468
+ batch: string;
3469
+ status: ModelPlatformDebtStatus;
3470
+ };
3471
+ type ModelPlatformAuditEvidence = {
3472
+ testsPassed: boolean;
3473
+ lintPassed: boolean;
3474
+ typecheckPassed: boolean;
3475
+ rollbackDrillPassed: boolean;
3476
+ };
3477
+ type ModelPlatformDebtCloseoutInput = {
3478
+ debts: ModelPlatformDebtItem[];
3479
+ auditEvidence: ModelPlatformAuditEvidence;
3480
+ };
3481
+ type ModelPlatformDebtCloseoutSummary = {
3482
+ openD0: number;
3483
+ openD1: number;
3484
+ openD2: number;
3485
+ invalidBatchOwnershipCount: number;
3486
+ evidenceCompleteness: number;
3487
+ };
3488
+ type ModelPlatformDebtCloseoutResult = {
3489
+ decision: 'go' | 'no-go';
3490
+ reasonCodes: string[];
3491
+ summary: ModelPlatformDebtCloseoutSummary;
3492
+ riskStatement: string;
3493
+ };
3494
+ declare function getProviderFacadeReleaseState(): ProviderFacadeReleaseState;
3495
+ declare function setProviderFacadeReleaseState(input: Partial<ProviderFacadeReleaseState>): ProviderFacadeReleaseState;
3496
+ declare function evaluateProviderFacadeRollout(input: ProviderFacadeRolloutInput): ProviderFacadeRolloutResult;
3497
+ declare function evaluateProviderFacadeAccess(input: ProviderFacadeAccessInput): ProviderFacadeAccessResult;
3498
+ declare function getProviderFacadeDeprecationChecklist(): ProviderFacadeDeprecationChecklist;
3499
+ declare function evaluateModelPlatformDebtCloseout(input: ModelPlatformDebtCloseoutInput): ModelPlatformDebtCloseoutResult;
3500
+ declare function getOpenworkMigrationMap(): OpenworkMigrationMap;
3501
+ declare function getOpenworkMigrationMapV2(): OpenworkMigrationMapV2;
3502
+ declare function runOpenworkCompatibilitySample(client: PybClient, input: OpenworkCompatibilitySampleInput): Promise<OpenworkCompatibilitySampleResult>;
3503
+
3256
3504
  /**
3257
3505
  * @pyb/sdk - PYB-CLI Server SDK
3258
3506
  *
@@ -3261,4 +3509,4 @@ declare function resolveDefaultBackendFromEnv(input?: {
3261
3509
 
3262
3510
  declare const SDK_VERSION = "0.1.0";
3263
3511
 
3264
- export { type APIError, type Attachment, type BackendKind, BackendKindSchema, type CanUseToolCallback, type CanUseToolDecision, type ContentBlock, ContentBlockSchema, type CreateSessionRequest, type CreateSessionResponse, DEFAULT_SESSION_BACKEND_ROUTER_CONFIG, type DualTrackMetrics, DualTrackMetricsSchema, type DualTrackRawStats, DualTrackRawStatsSchema, type DualTrackThresholds, DualTrackThresholdsSchema, type ErrorEvent, ErrorEventSchema, type ErrorStreamEvent, ErrorStreamEventSchema, FALLBACK_TRIGGER_MATRIX, type FallbackTriggerReason, FallbackTriggerReasonSchema, type HealthResponse, type Message, type MessageCompletedEvent, MessageCompletedEventSchema, type MessageCreatedEvent, MessageCreatedEventSchema, MessageSchema, type MessageUpdatedEvent, MessageUpdatedEventSchema, PROTOCOL_ERROR_TO_RUNTIME_ERROR_TYPE, type PermissionEvaluator, type PermissionMode, type PermissionRequestedEvent, PermissionRequestedEventSchema, type PermissionRespondedEvent, PermissionRespondedEventSchema, type PermissionResponseRequest, type PermissionTimeoutEvent, PermissionTimeoutEventSchema, type PromptRequest, type PromptResponse, type ProtocolErrorCode, ProtocolErrorCodeSchema, type ProtocolErrorMapping, ProtocolErrorMappingSchema, type ProtocolSessionStreamBinding, ProtocolSessionStreamBindingManager, PybClient, type PybSSEEvent, PybSSEEventSchema, type QuerySessionExecutor, type RequestCompletedEvent, RequestCompletedEventSchema, type RequestStartedEvent, RequestStartedEventSchema, type ResolvePermissionDecisionInput, type RuntimeBackendErrorPhase, type RuntimeCompatibleLegacyEvent, type RuntimeEvent, type RuntimeEventDomain, RuntimeEventDomainSchema, type RuntimeEventErrorType, RuntimeEventErrorTypeSchema, RuntimeEventSchema, type RuntimePermissionPolicy, type RuntimeSession, type RuntimeSessionConfig, type RuntimeSessionEvent, RuntimeSessionEventSchema, type RuntimeSessionInput, RuntimeSessionInputSchema, type RuntimeSessionStatus, RuntimeSessionStatusSchema, S4_PROTOCOL_ERROR_TOP_CODES, S5_A0_EQUIVALENCE_SAMPLE_SET, SDK_VERSION, SESSION_BACKEND_CONFIG_CONTRACT_VERSION, SESSION_BACKEND_ENV_KEY, SESSION_BACKEND_OBSERVABILITY_SPEC, SSEClient, type SSEDedupEvent, SSEDedupEventSchema, type SSEEvent, type SSEReplayEvent, SSEReplayEventSchema, type SSEReplayGapEvent, SSEReplayGapEventSchema, type ServerConnectedEvent, ServerConnectedEventSchema, type ServerHeartbeatEvent, ServerHeartbeatEventSchema, type ServerStatusEvent, ServerStatusEventSchema, type SessionBackend, type SessionBackendRouteSource, type SessionBackendRouterConfig, SessionBackendRouterConfigSchema, type SessionBackendSession, type SessionBackendUserConfig, type SessionCreatedEvent, SessionCreatedEventSchema, type SessionDeletedEvent, SessionDeletedEventSchema, type SessionEventPublisher, type SessionInfo, type SessionUpdatedEvent, SessionUpdatedEventSchema, type ToolCompletedEvent, ToolCompletedEventSchema, type ToolErrorEvent, ToolErrorEventSchema, type ToolInfo, type ToolPermissionContext, type ToolProgressEvent, ToolProgressEventSchema, type ToolResolver, type ToolStartedEvent, ToolStartedEventSchema, type V2Message, V2MessageSchema, V2RequestStatusSchema, type V2Session, V2SessionSchema, type V2SessionStatus, V2SessionStatusSchema, type V2ToolUseContext, V2ToolUseContextSchema, buildDefaultDualTrackThresholds, buildV2ToolUseContextFromPromptRequest, canTransitionV2SessionStatus, createDefaultToolPermissionContextForSdk, createProtocolSessionBackend, createRuntimePermissionContextForSession, createRuntimeSession, createRuntimeSessionBackend, createSSEClient, createSessionBackendRouter, emitBackendConfigWarning, evaluateDualTrackMetrics, evaluateV1DeprecationReadiness, getRuntimeEventMappingRules, isToolAutoExecutableInContext, mapProtocolErrorCodeToRuntimeErrorType, mapRuntimeBackendErrorToRuntimeEvent, mapRuntimeMessageToV2, mapRuntimeSessionStatusToV2, mapV1MessageToV2, mapV1SessionStatusToV2, projectLegacyEventToRuntimeEvent, projectRuntimeEventToLegacyEvent, resolveDefaultBackend, resolveDefaultBackendFromEnv, resolvePermissionDecision, resolvePermissionModeForSdk, resolveRouterBackendKind, shouldTriggerFallback, validateV2Message, validateV2Session, validateV2ToolUseContext };
3512
+ export { type APIError, type Attachment, type AuthRemoveResponse, type AuthSetRequest, type AuthSetResponse, type BackendKind, BackendKindSchema, type CanUseToolCallback, type CanUseToolDecision, type CompatibilityWindowPolicy, type ContentBlock, ContentBlockSchema, type CreateSessionRequest, type CreateSessionResponse, DEFAULT_SESSION_BACKEND_ROUTER_CONFIG, type DualTrackMetrics, DualTrackMetricsSchema, type DualTrackRawStats, DualTrackRawStatsSchema, type DualTrackThresholds, DualTrackThresholdsSchema, type ErrorEvent, ErrorEventSchema, type ErrorStreamEvent, ErrorStreamEventSchema, FALLBACK_TRIGGER_MATRIX, type FallbackTriggerReason, FallbackTriggerReasonSchema, type HealthResponse, type Message, type MessageCompletedEvent, MessageCompletedEventSchema, type MessageCreatedEvent, MessageCreatedEventSchema, MessageSchema, type MessageUpdatedEvent, MessageUpdatedEventSchema, type ModelPlatformAuditEvidence, type ModelPlatformDebtCloseoutInput, type ModelPlatformDebtCloseoutResult, type ModelPlatformDebtCloseoutSummary, type ModelPlatformDebtItem, type ModelPlatformDebtSeverity, type ModelPlatformDebtStatus, type ModelPoolSourceRecord, type ModelPoolStatusItem, type ModelPoolStatusResponse, type ModelRef, type OpenworkAuthModalSample, type OpenworkCompatibilitySampleInput, type OpenworkCompatibilitySampleResult, type OpenworkEndpointMapping, type OpenworkErrorMapping, type OpenworkFieldMapping, type OpenworkGoNoGoResult, type OpenworkMigrationMap, type OpenworkMigrationMapV2, type OpenworkModelSetSample, type OpenworkProviderPickerSample, PROTOCOL_ERROR_TO_RUNTIME_ERROR_TYPE, type PermissionEvaluator, type PermissionMode, type PermissionRequestedEvent, PermissionRequestedEventSchema, type PermissionRespondedEvent, PermissionRespondedEventSchema, type PermissionResponseRequest, type PermissionTimeoutEvent, PermissionTimeoutEventSchema, type PromptRequest, type PromptResponse, type ProtocolErrorCode, ProtocolErrorCodeSchema, type ProtocolErrorMapping, ProtocolErrorMappingSchema, type ProtocolSessionStreamBinding, ProtocolSessionStreamBindingManager, type ProviderAuthMethod, type ProviderFacadeAccessInput, type ProviderFacadeAccessResult, type ProviderFacadeDeprecationChecklist, type ProviderFacadeEnvironment, type ProviderFacadeFeatureFlag, type ProviderFacadeReleaseState, type ProviderFacadeRolloutInput, type ProviderFacadeRolloutResult, type ProviderListResponse, type ProviderOAuthAuthorizeRequest, type ProviderOAuthAuthorizeResponse, type ProviderOAuthCallbackRequest, type ProviderOAuthCallbackResponse, type ProviderRef, PybClient, type PybSSEEvent, PybSSEEventSchema, type QuerySessionExecutor, type RequestCompletedEvent, RequestCompletedEventSchema, type RequestStartedEvent, RequestStartedEventSchema, type ResolvePermissionDecisionInput, type RuntimeBackendErrorPhase, type RuntimeCompatibleLegacyEvent, type RuntimeEvent, type RuntimeEventDomain, RuntimeEventDomainSchema, type RuntimeEventErrorType, RuntimeEventErrorTypeSchema, RuntimeEventSchema, type RuntimePermissionPolicy, type RuntimeSession, type RuntimeSessionConfig, type RuntimeSessionEvent, RuntimeSessionEventSchema, type RuntimeSessionInput, RuntimeSessionInputSchema, type RuntimeSessionStatus, RuntimeSessionStatusSchema, S4_PROTOCOL_ERROR_TOP_CODES, S5_A0_EQUIVALENCE_SAMPLE_SET, SDK_VERSION, SESSION_BACKEND_CONFIG_CONTRACT_VERSION, SESSION_BACKEND_ENV_KEY, SESSION_BACKEND_OBSERVABILITY_SPEC, SSEClient, type SSEDedupEvent, SSEDedupEventSchema, type SSEEvent, type SSEReplayEvent, SSEReplayEventSchema, type SSEReplayGapEvent, SSEReplayGapEventSchema, type ServerConnectedEvent, ServerConnectedEventSchema, type ServerHeartbeatEvent, ServerHeartbeatEventSchema, type ServerStatusEvent, ServerStatusEventSchema, type SessionBackend, type SessionBackendRouteSource, type SessionBackendRouterConfig, SessionBackendRouterConfigSchema, type SessionBackendSession, type SessionBackendUserConfig, type SessionCreatedEvent, SessionCreatedEventSchema, type SessionDeletedEvent, SessionDeletedEventSchema, type SessionEventPublisher, type SessionInfo, type SessionUpdatedEvent, SessionUpdatedEventSchema, type SetDefaultModelRequest, type SetDefaultModelResponse, type ToolCompletedEvent, ToolCompletedEventSchema, type ToolErrorEvent, ToolErrorEventSchema, type ToolInfo, type ToolPermissionContext, type ToolProgressEvent, ToolProgressEventSchema, type ToolResolver, type ToolStartedEvent, ToolStartedEventSchema, type V2Message, V2MessageSchema, V2RequestStatusSchema, type V2Session, V2SessionSchema, type V2SessionStatus, V2SessionStatusSchema, type V2ToolUseContext, V2ToolUseContextSchema, buildDefaultDualTrackThresholds, buildV2ToolUseContextFromPromptRequest, canTransitionV2SessionStatus, createDefaultToolPermissionContextForSdk, createProtocolSessionBackend, createRuntimePermissionContextForSession, createRuntimeSession, createRuntimeSessionBackend, createSSEClient, createSessionBackendRouter, emitBackendConfigWarning, evaluateDualTrackMetrics, evaluateModelPlatformDebtCloseout, evaluateProviderFacadeAccess, evaluateProviderFacadeRollout, evaluateV1DeprecationReadiness, getOpenworkMigrationMap, getOpenworkMigrationMapV2, getProviderFacadeDeprecationChecklist, getProviderFacadeReleaseState, getRuntimeEventMappingRules, isToolAutoExecutableInContext, mapProtocolErrorCodeToRuntimeErrorType, mapRuntimeBackendErrorToRuntimeEvent, mapRuntimeMessageToV2, mapRuntimeSessionStatusToV2, mapV1MessageToV2, mapV1SessionStatusToV2, projectLegacyEventToRuntimeEvent, projectRuntimeEventToLegacyEvent, resolveDefaultBackend, resolveDefaultBackendFromEnv, resolvePermissionDecision, resolvePermissionModeForSdk, resolveRouterBackendKind, runOpenworkCompatibilitySample, setProviderFacadeReleaseState, shouldTriggerFallback, validateV2Message, validateV2Session, validateV2ToolUseContext };