pybao-xc-sdk 1.5.56 → 1.5.57

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/dist/index.d.mts CHANGED
@@ -2397,23 +2397,6 @@ interface CreateSessionResponse {
2397
2397
  outputStyle: string;
2398
2398
  };
2399
2399
  }
2400
- type WorkspaceButtonGateReason = 'supported' | 'health_unavailable' | 'create_echo_missing' | 'session_echo_missing' | 'list_echo_missing' | 'probe_failed';
2401
- interface WorkspaceButtonCopy {
2402
- label: '新会话工作区';
2403
- description: '工作区切换影响新会话运行目录';
2404
- sharedModelNotice: '模型池仍为全局共享,默认模型可按工作区覆盖';
2405
- disabledNotice: '当前 pyb 版本未完成工作区能力升级时,此功能保持禁用';
2406
- }
2407
- interface WorkspaceNewSessionButtonState {
2408
- enabled: boolean;
2409
- reason: WorkspaceButtonGateReason;
2410
- requestedCwd: string;
2411
- serverVersion?: string;
2412
- createEchoedCwd?: string;
2413
- sessionEchoedCwd?: string;
2414
- listEchoedCwd?: string;
2415
- copy: WorkspaceButtonCopy;
2416
- }
2417
2400
  interface PromptRequest {
2418
2401
  message: string;
2419
2402
  attachments?: Attachment[];
@@ -2502,11 +2485,13 @@ interface PybClientConfig {
2502
2485
  baseUrl?: string;
2503
2486
  timeout?: number;
2504
2487
  headers?: Record<string, string>;
2488
+ directory?: string;
2505
2489
  }
2506
2490
  declare class PybClient {
2507
2491
  private baseUrl;
2508
2492
  private timeout;
2509
2493
  private headers;
2494
+ readonly directory: string | undefined;
2510
2495
  readonly session: {
2511
2496
  create: (request?: CreateSessionRequest) => Promise<CreateSessionResponse>;
2512
2497
  list: (params?: {
@@ -2587,13 +2572,9 @@ declare class PybClient {
2587
2572
  readonly modelPool: {
2588
2573
  status: () => Promise<ModelPoolStatusResponse>;
2589
2574
  };
2590
- readonly workspace: {
2591
- getNewSessionButtonState: (cwd: string) => Promise<WorkspaceNewSessionButtonState>;
2592
- };
2593
2575
  constructor(config?: PybClientConfig);
2594
2576
  getHealth(): Promise<HealthResponse>;
2595
- private getWorkspaceButtonCopy;
2596
- private getWorkspaceNewSessionButtonStateRequest;
2577
+ withDirectory(directory: string): PybClient;
2597
2578
  private createSessionRequest;
2598
2579
  private listSessionsRequest;
2599
2580
  private getSessionRequest;
@@ -2630,6 +2611,7 @@ declare class PybClient {
2630
2611
  private isRecoverableResponseStatus;
2631
2612
  private fetch;
2632
2613
  }
2614
+ declare function createPybClient(config?: PybClientConfig): PybClient;
2633
2615
 
2634
2616
  interface SSEClientOptions {
2635
2617
  baseUrl?: string;
@@ -3460,6 +3442,6 @@ declare function resolveDefaultBackendFromEnv(input?: {
3460
3442
  routeSource: SessionBackendRouteSource;
3461
3443
  };
3462
3444
 
3463
- declare const SDK_VERSION = "1.5.56";
3445
+ declare const SDK_VERSION = "1.5.57";
3464
3446
 
3465
- export { type APIError, type Attachment, type AuthRemoveResponse, type AuthSetRequest, type AuthSetResponse, 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 GetDefaultModelRequest, type GetDefaultModelResponse, type HealthResponse, type Message, type MessageCompletedEvent, MessageCompletedEventSchema, type MessageCreatedEvent, MessageCreatedEventSchema, MessageSchema, type MessageUpdatedEvent, MessageUpdatedEventSchema, type ModelCatalogItem, type ModelCatalogResponse, type ModelPoolSourceRecord, type ModelPoolStatusItem, type ModelPoolStatusResponse, type ModelRef, 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 ProviderListResponse, type ProviderOAuthAuthorizeRequest, type ProviderOAuthAuthorizeResponse, type ProviderOAuthCallbackRequest, type ProviderOAuthCallbackResponse, type ProviderRef, PybAPIError, PybClient, PybConfigError, PybNetworkError, PybResponseParseError, type PybSSEEvent, PybSSEEventSchema, type QuerySessionExecutor, type RequestCompletedEvent, RequestCompletedEventSchema, type RequestStartedEvent, RequestStartedEventSchema, type ResolvePermissionDecisionInput, type ResolveRuntimeModelRequest, type ResolveRuntimeModelResponse, 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, type WorkspaceButtonCopy, type WorkspaceButtonGateReason, type WorkspaceNewSessionButtonState, 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 };
3447
+ export { type APIError, type Attachment, type AuthRemoveResponse, type AuthSetRequest, type AuthSetResponse, 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 GetDefaultModelRequest, type GetDefaultModelResponse, type HealthResponse, type Message, type MessageCompletedEvent, MessageCompletedEventSchema, type MessageCreatedEvent, MessageCreatedEventSchema, MessageSchema, type MessageUpdatedEvent, MessageUpdatedEventSchema, type ModelCatalogItem, type ModelCatalogResponse, type ModelPoolSourceRecord, type ModelPoolStatusItem, type ModelPoolStatusResponse, type ModelRef, 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 ProviderListResponse, type ProviderOAuthAuthorizeRequest, type ProviderOAuthAuthorizeResponse, type ProviderOAuthCallbackRequest, type ProviderOAuthCallbackResponse, type ProviderRef, PybAPIError, PybClient, PybConfigError, PybNetworkError, PybResponseParseError, type PybSSEEvent, PybSSEEventSchema, type QuerySessionExecutor, type RequestCompletedEvent, RequestCompletedEventSchema, type RequestStartedEvent, RequestStartedEventSchema, type ResolvePermissionDecisionInput, type ResolveRuntimeModelRequest, type ResolveRuntimeModelResponse, 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, createPybClient, 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 };
package/dist/index.d.ts CHANGED
@@ -2397,23 +2397,6 @@ interface CreateSessionResponse {
2397
2397
  outputStyle: string;
2398
2398
  };
2399
2399
  }
2400
- type WorkspaceButtonGateReason = 'supported' | 'health_unavailable' | 'create_echo_missing' | 'session_echo_missing' | 'list_echo_missing' | 'probe_failed';
2401
- interface WorkspaceButtonCopy {
2402
- label: '新会话工作区';
2403
- description: '工作区切换影响新会话运行目录';
2404
- sharedModelNotice: '模型池仍为全局共享,默认模型可按工作区覆盖';
2405
- disabledNotice: '当前 pyb 版本未完成工作区能力升级时,此功能保持禁用';
2406
- }
2407
- interface WorkspaceNewSessionButtonState {
2408
- enabled: boolean;
2409
- reason: WorkspaceButtonGateReason;
2410
- requestedCwd: string;
2411
- serverVersion?: string;
2412
- createEchoedCwd?: string;
2413
- sessionEchoedCwd?: string;
2414
- listEchoedCwd?: string;
2415
- copy: WorkspaceButtonCopy;
2416
- }
2417
2400
  interface PromptRequest {
2418
2401
  message: string;
2419
2402
  attachments?: Attachment[];
@@ -2502,11 +2485,13 @@ interface PybClientConfig {
2502
2485
  baseUrl?: string;
2503
2486
  timeout?: number;
2504
2487
  headers?: Record<string, string>;
2488
+ directory?: string;
2505
2489
  }
2506
2490
  declare class PybClient {
2507
2491
  private baseUrl;
2508
2492
  private timeout;
2509
2493
  private headers;
2494
+ readonly directory: string | undefined;
2510
2495
  readonly session: {
2511
2496
  create: (request?: CreateSessionRequest) => Promise<CreateSessionResponse>;
2512
2497
  list: (params?: {
@@ -2587,13 +2572,9 @@ declare class PybClient {
2587
2572
  readonly modelPool: {
2588
2573
  status: () => Promise<ModelPoolStatusResponse>;
2589
2574
  };
2590
- readonly workspace: {
2591
- getNewSessionButtonState: (cwd: string) => Promise<WorkspaceNewSessionButtonState>;
2592
- };
2593
2575
  constructor(config?: PybClientConfig);
2594
2576
  getHealth(): Promise<HealthResponse>;
2595
- private getWorkspaceButtonCopy;
2596
- private getWorkspaceNewSessionButtonStateRequest;
2577
+ withDirectory(directory: string): PybClient;
2597
2578
  private createSessionRequest;
2598
2579
  private listSessionsRequest;
2599
2580
  private getSessionRequest;
@@ -2630,6 +2611,7 @@ declare class PybClient {
2630
2611
  private isRecoverableResponseStatus;
2631
2612
  private fetch;
2632
2613
  }
2614
+ declare function createPybClient(config?: PybClientConfig): PybClient;
2633
2615
 
2634
2616
  interface SSEClientOptions {
2635
2617
  baseUrl?: string;
@@ -3460,6 +3442,6 @@ declare function resolveDefaultBackendFromEnv(input?: {
3460
3442
  routeSource: SessionBackendRouteSource;
3461
3443
  };
3462
3444
 
3463
- declare const SDK_VERSION = "1.5.56";
3445
+ declare const SDK_VERSION = "1.5.57";
3464
3446
 
3465
- export { type APIError, type Attachment, type AuthRemoveResponse, type AuthSetRequest, type AuthSetResponse, 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 GetDefaultModelRequest, type GetDefaultModelResponse, type HealthResponse, type Message, type MessageCompletedEvent, MessageCompletedEventSchema, type MessageCreatedEvent, MessageCreatedEventSchema, MessageSchema, type MessageUpdatedEvent, MessageUpdatedEventSchema, type ModelCatalogItem, type ModelCatalogResponse, type ModelPoolSourceRecord, type ModelPoolStatusItem, type ModelPoolStatusResponse, type ModelRef, 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 ProviderListResponse, type ProviderOAuthAuthorizeRequest, type ProviderOAuthAuthorizeResponse, type ProviderOAuthCallbackRequest, type ProviderOAuthCallbackResponse, type ProviderRef, PybAPIError, PybClient, PybConfigError, PybNetworkError, PybResponseParseError, type PybSSEEvent, PybSSEEventSchema, type QuerySessionExecutor, type RequestCompletedEvent, RequestCompletedEventSchema, type RequestStartedEvent, RequestStartedEventSchema, type ResolvePermissionDecisionInput, type ResolveRuntimeModelRequest, type ResolveRuntimeModelResponse, 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, type WorkspaceButtonCopy, type WorkspaceButtonGateReason, type WorkspaceNewSessionButtonState, 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 };
3447
+ export { type APIError, type Attachment, type AuthRemoveResponse, type AuthSetRequest, type AuthSetResponse, 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 GetDefaultModelRequest, type GetDefaultModelResponse, type HealthResponse, type Message, type MessageCompletedEvent, MessageCompletedEventSchema, type MessageCreatedEvent, MessageCreatedEventSchema, MessageSchema, type MessageUpdatedEvent, MessageUpdatedEventSchema, type ModelCatalogItem, type ModelCatalogResponse, type ModelPoolSourceRecord, type ModelPoolStatusItem, type ModelPoolStatusResponse, type ModelRef, 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 ProviderListResponse, type ProviderOAuthAuthorizeRequest, type ProviderOAuthAuthorizeResponse, type ProviderOAuthCallbackRequest, type ProviderOAuthCallbackResponse, type ProviderRef, PybAPIError, PybClient, PybConfigError, PybNetworkError, PybResponseParseError, type PybSSEEvent, PybSSEEventSchema, type QuerySessionExecutor, type RequestCompletedEvent, RequestCompletedEventSchema, type RequestStartedEvent, RequestStartedEventSchema, type ResolvePermissionDecisionInput, type ResolveRuntimeModelRequest, type ResolveRuntimeModelResponse, 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, createPybClient, 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 };
package/dist/index.js CHANGED
@@ -86,6 +86,7 @@ __export(index_exports, {
86
86
  canTransitionV2SessionStatus: () => canTransitionV2SessionStatus,
87
87
  createDefaultToolPermissionContextForSdk: () => createDefaultToolPermissionContextForSdk,
88
88
  createProtocolSessionBackend: () => createProtocolSessionBackend,
89
+ createPybClient: () => createPybClient,
89
90
  createRuntimePermissionContextForSession: () => createRuntimePermissionContextForSession,
90
91
  createRuntimeSession: () => createRuntimeSession,
91
92
  createRuntimeSessionBackend: () => createRuntimeSessionBackend,
@@ -441,7 +442,8 @@ var PYB_CLIENT_DEFAULT_TIMEOUT = 12e4;
441
442
  var pybClientConfigSchema = import_zod2.z.object({
442
443
  baseUrl: import_zod2.z.string().url().optional(),
443
444
  timeout: import_zod2.z.number().finite().positive().optional(),
444
- headers: import_zod2.z.record(import_zod2.z.string()).optional()
445
+ headers: import_zod2.z.record(import_zod2.z.string()).optional(),
446
+ directory: import_zod2.z.string().min(1).optional()
445
447
  });
446
448
  function normalizePybClientConfig(input) {
447
449
  const parsed = pybClientConfigSchema.safeParse(input);
@@ -463,7 +465,8 @@ function normalizePybClientConfig(input) {
463
465
  headers: {
464
466
  "Content-Type": "application/json",
465
467
  ...parsed.data.headers ?? {}
466
- }
468
+ },
469
+ directory: parsed.data.directory
467
470
  }
468
471
  };
469
472
  }
@@ -521,10 +524,11 @@ var PybResponseParseError = class extends PybAPIError {
521
524
  };
522
525
 
523
526
  // src/client.ts
524
- var PybClient = class {
527
+ var PybClient = class _PybClient {
525
528
  baseUrl;
526
529
  timeout;
527
530
  headers;
531
+ directory;
528
532
  session;
529
533
  mcp;
530
534
  tool;
@@ -534,7 +538,6 @@ var PybClient = class {
534
538
  runtime;
535
539
  auth;
536
540
  modelPool;
537
- workspace;
538
541
  constructor(config = {}) {
539
542
  const normalizedConfig = normalizePybClientConfig(config);
540
543
  if (normalizedConfig.success === false) {
@@ -545,6 +548,7 @@ var PybClient = class {
545
548
  this.baseUrl = normalizedConfig.data.baseUrl;
546
549
  this.timeout = normalizedConfig.data.timeout;
547
550
  this.headers = normalizedConfig.data.headers;
551
+ this.directory = normalizedConfig.data.directory;
548
552
  this.session = {
549
553
  create: (request = {}) => this.createSessionRequest(request),
550
554
  list: (params) => this.listSessionsRequest(params),
@@ -591,9 +595,6 @@ var PybClient = class {
591
595
  this.modelPool = {
592
596
  status: () => this.getModelPoolStatusRequest()
593
597
  };
594
- this.workspace = {
595
- getNewSessionButtonState: (cwd) => this.getWorkspaceNewSessionButtonStateRequest(cwd)
596
- };
597
598
  }
598
599
  // ============================================================
599
600
  // Health API
@@ -602,107 +603,22 @@ var PybClient = class {
602
603
  const response = await this.fetch("/health");
603
604
  return this.parseJson(response, "/health");
604
605
  }
605
- getWorkspaceButtonCopy() {
606
- return {
607
- label: "\u65B0\u4F1A\u8BDD\u5DE5\u4F5C\u533A",
608
- description: "\u5DE5\u4F5C\u533A\u5207\u6362\u5F71\u54CD\u65B0\u4F1A\u8BDD\u8FD0\u884C\u76EE\u5F55",
609
- sharedModelNotice: "\u6A21\u578B\u6C60\u4ECD\u4E3A\u5168\u5C40\u5171\u4EAB\uFF0C\u9ED8\u8BA4\u6A21\u578B\u53EF\u6309\u5DE5\u4F5C\u533A\u8986\u76D6",
610
- disabledNotice: "\u5F53\u524D pyb \u7248\u672C\u672A\u5B8C\u6210\u5DE5\u4F5C\u533A\u80FD\u529B\u5347\u7EA7\u65F6\uFF0C\u6B64\u529F\u80FD\u4FDD\u6301\u7981\u7528"
611
- };
612
- }
613
- async getWorkspaceNewSessionButtonStateRequest(cwd) {
614
- const copy = this.getWorkspaceButtonCopy();
615
- let serverVersion;
616
- try {
617
- const health = await this.getHealth();
618
- serverVersion = health.version;
619
- } catch {
620
- return {
621
- enabled: false,
622
- reason: "health_unavailable",
623
- requestedCwd: cwd,
624
- copy
625
- };
626
- }
627
- let sessionId;
628
- let createEchoedCwd;
629
- let sessionEchoedCwd;
630
- let listEchoedCwd;
631
- try {
632
- const created = await this.createSessionRequest({ cwd });
633
- sessionId = created.sessionId;
634
- createEchoedCwd = created.cwd;
635
- if (createEchoedCwd !== cwd) {
636
- return {
637
- enabled: false,
638
- reason: "create_echo_missing",
639
- requestedCwd: cwd,
640
- serverVersion,
641
- createEchoedCwd,
642
- copy
643
- };
644
- }
645
- const session = await this.getSessionRequest(sessionId);
646
- sessionEchoedCwd = session.cwd;
647
- if (sessionEchoedCwd !== cwd) {
648
- return {
649
- enabled: false,
650
- reason: "session_echo_missing",
651
- requestedCwd: cwd,
652
- serverVersion,
653
- createEchoedCwd,
654
- sessionEchoedCwd,
655
- copy
656
- };
657
- }
658
- const listedSessions = await this.listSessionsRequest({ limit: 100 });
659
- listEchoedCwd = listedSessions.items.find((item) => item.id === sessionId)?.cwd;
660
- if (listEchoedCwd !== cwd) {
661
- return {
662
- enabled: false,
663
- reason: "list_echo_missing",
664
- requestedCwd: cwd,
665
- serverVersion,
666
- createEchoedCwd,
667
- sessionEchoedCwd,
668
- listEchoedCwd,
669
- copy
670
- };
671
- }
672
- return {
673
- enabled: true,
674
- reason: "supported",
675
- requestedCwd: cwd,
676
- serverVersion,
677
- createEchoedCwd,
678
- sessionEchoedCwd,
679
- listEchoedCwd,
680
- copy
681
- };
682
- } catch {
683
- return {
684
- enabled: false,
685
- reason: "probe_failed",
686
- requestedCwd: cwd,
687
- serverVersion,
688
- createEchoedCwd,
689
- sessionEchoedCwd,
690
- listEchoedCwd,
691
- copy
692
- };
693
- } finally {
694
- if (sessionId) {
695
- await this.deleteSessionRequest(sessionId).catch(() => void 0);
696
- }
697
- }
606
+ withDirectory(directory) {
607
+ return new _PybClient({
608
+ baseUrl: this.baseUrl,
609
+ timeout: this.timeout,
610
+ headers: this.headers,
611
+ directory
612
+ });
698
613
  }
699
614
  // ============================================================
700
615
  // Session API
701
616
  // ============================================================
702
617
  async createSessionRequest(request = {}) {
618
+ const payload = request.cwd === void 0 && this.directory !== void 0 ? { ...request, cwd: this.directory } : request;
703
619
  const response = await this.fetch("/sessions", {
704
620
  method: "POST",
705
- body: JSON.stringify(request)
621
+ body: JSON.stringify(payload)
706
622
  });
707
623
  return this.parseData(response, "/sessions");
708
624
  }
@@ -1002,6 +918,9 @@ var PybClient = class {
1002
918
  }
1003
919
  }
1004
920
  };
921
+ function createPybClient(config = {}) {
922
+ return new PybClient(config);
923
+ }
1005
924
 
1006
925
  // src/sse.ts
1007
926
  var DEFAULT_CONNECT_TIMEOUT_MS = 1e4;
@@ -2681,7 +2600,7 @@ function isRecord4(value) {
2681
2600
  }
2682
2601
 
2683
2602
  // src/version.ts
2684
- var SDK_VERSION = "1.5.56";
2603
+ var SDK_VERSION = "1.5.57";
2685
2604
  // Annotate the CommonJS export names for ESM import in node:
2686
2605
  0 && (module.exports = {
2687
2606
  BackendKindSchema,
@@ -2750,6 +2669,7 @@ var SDK_VERSION = "1.5.56";
2750
2669
  canTransitionV2SessionStatus,
2751
2670
  createDefaultToolPermissionContextForSdk,
2752
2671
  createProtocolSessionBackend,
2672
+ createPybClient,
2753
2673
  createRuntimePermissionContextForSession,
2754
2674
  createRuntimeSession,
2755
2675
  createRuntimeSessionBackend,
package/dist/index.mjs CHANGED
@@ -323,7 +323,8 @@ var PYB_CLIENT_DEFAULT_TIMEOUT = 12e4;
323
323
  var pybClientConfigSchema = z2.object({
324
324
  baseUrl: z2.string().url().optional(),
325
325
  timeout: z2.number().finite().positive().optional(),
326
- headers: z2.record(z2.string()).optional()
326
+ headers: z2.record(z2.string()).optional(),
327
+ directory: z2.string().min(1).optional()
327
328
  });
328
329
  function normalizePybClientConfig(input) {
329
330
  const parsed = pybClientConfigSchema.safeParse(input);
@@ -345,7 +346,8 @@ function normalizePybClientConfig(input) {
345
346
  headers: {
346
347
  "Content-Type": "application/json",
347
348
  ...parsed.data.headers ?? {}
348
- }
349
+ },
350
+ directory: parsed.data.directory
349
351
  }
350
352
  };
351
353
  }
@@ -403,10 +405,11 @@ var PybResponseParseError = class extends PybAPIError {
403
405
  };
404
406
 
405
407
  // src/client.ts
406
- var PybClient = class {
408
+ var PybClient = class _PybClient {
407
409
  baseUrl;
408
410
  timeout;
409
411
  headers;
412
+ directory;
410
413
  session;
411
414
  mcp;
412
415
  tool;
@@ -416,7 +419,6 @@ var PybClient = class {
416
419
  runtime;
417
420
  auth;
418
421
  modelPool;
419
- workspace;
420
422
  constructor(config = {}) {
421
423
  const normalizedConfig = normalizePybClientConfig(config);
422
424
  if (normalizedConfig.success === false) {
@@ -427,6 +429,7 @@ var PybClient = class {
427
429
  this.baseUrl = normalizedConfig.data.baseUrl;
428
430
  this.timeout = normalizedConfig.data.timeout;
429
431
  this.headers = normalizedConfig.data.headers;
432
+ this.directory = normalizedConfig.data.directory;
430
433
  this.session = {
431
434
  create: (request = {}) => this.createSessionRequest(request),
432
435
  list: (params) => this.listSessionsRequest(params),
@@ -473,9 +476,6 @@ var PybClient = class {
473
476
  this.modelPool = {
474
477
  status: () => this.getModelPoolStatusRequest()
475
478
  };
476
- this.workspace = {
477
- getNewSessionButtonState: (cwd) => this.getWorkspaceNewSessionButtonStateRequest(cwd)
478
- };
479
479
  }
480
480
  // ============================================================
481
481
  // Health API
@@ -484,107 +484,22 @@ var PybClient = class {
484
484
  const response = await this.fetch("/health");
485
485
  return this.parseJson(response, "/health");
486
486
  }
487
- getWorkspaceButtonCopy() {
488
- return {
489
- label: "\u65B0\u4F1A\u8BDD\u5DE5\u4F5C\u533A",
490
- description: "\u5DE5\u4F5C\u533A\u5207\u6362\u5F71\u54CD\u65B0\u4F1A\u8BDD\u8FD0\u884C\u76EE\u5F55",
491
- sharedModelNotice: "\u6A21\u578B\u6C60\u4ECD\u4E3A\u5168\u5C40\u5171\u4EAB\uFF0C\u9ED8\u8BA4\u6A21\u578B\u53EF\u6309\u5DE5\u4F5C\u533A\u8986\u76D6",
492
- disabledNotice: "\u5F53\u524D pyb \u7248\u672C\u672A\u5B8C\u6210\u5DE5\u4F5C\u533A\u80FD\u529B\u5347\u7EA7\u65F6\uFF0C\u6B64\u529F\u80FD\u4FDD\u6301\u7981\u7528"
493
- };
494
- }
495
- async getWorkspaceNewSessionButtonStateRequest(cwd) {
496
- const copy = this.getWorkspaceButtonCopy();
497
- let serverVersion;
498
- try {
499
- const health = await this.getHealth();
500
- serverVersion = health.version;
501
- } catch {
502
- return {
503
- enabled: false,
504
- reason: "health_unavailable",
505
- requestedCwd: cwd,
506
- copy
507
- };
508
- }
509
- let sessionId;
510
- let createEchoedCwd;
511
- let sessionEchoedCwd;
512
- let listEchoedCwd;
513
- try {
514
- const created = await this.createSessionRequest({ cwd });
515
- sessionId = created.sessionId;
516
- createEchoedCwd = created.cwd;
517
- if (createEchoedCwd !== cwd) {
518
- return {
519
- enabled: false,
520
- reason: "create_echo_missing",
521
- requestedCwd: cwd,
522
- serverVersion,
523
- createEchoedCwd,
524
- copy
525
- };
526
- }
527
- const session = await this.getSessionRequest(sessionId);
528
- sessionEchoedCwd = session.cwd;
529
- if (sessionEchoedCwd !== cwd) {
530
- return {
531
- enabled: false,
532
- reason: "session_echo_missing",
533
- requestedCwd: cwd,
534
- serverVersion,
535
- createEchoedCwd,
536
- sessionEchoedCwd,
537
- copy
538
- };
539
- }
540
- const listedSessions = await this.listSessionsRequest({ limit: 100 });
541
- listEchoedCwd = listedSessions.items.find((item) => item.id === sessionId)?.cwd;
542
- if (listEchoedCwd !== cwd) {
543
- return {
544
- enabled: false,
545
- reason: "list_echo_missing",
546
- requestedCwd: cwd,
547
- serverVersion,
548
- createEchoedCwd,
549
- sessionEchoedCwd,
550
- listEchoedCwd,
551
- copy
552
- };
553
- }
554
- return {
555
- enabled: true,
556
- reason: "supported",
557
- requestedCwd: cwd,
558
- serverVersion,
559
- createEchoedCwd,
560
- sessionEchoedCwd,
561
- listEchoedCwd,
562
- copy
563
- };
564
- } catch {
565
- return {
566
- enabled: false,
567
- reason: "probe_failed",
568
- requestedCwd: cwd,
569
- serverVersion,
570
- createEchoedCwd,
571
- sessionEchoedCwd,
572
- listEchoedCwd,
573
- copy
574
- };
575
- } finally {
576
- if (sessionId) {
577
- await this.deleteSessionRequest(sessionId).catch(() => void 0);
578
- }
579
- }
487
+ withDirectory(directory) {
488
+ return new _PybClient({
489
+ baseUrl: this.baseUrl,
490
+ timeout: this.timeout,
491
+ headers: this.headers,
492
+ directory
493
+ });
580
494
  }
581
495
  // ============================================================
582
496
  // Session API
583
497
  // ============================================================
584
498
  async createSessionRequest(request = {}) {
499
+ const payload = request.cwd === void 0 && this.directory !== void 0 ? { ...request, cwd: this.directory } : request;
585
500
  const response = await this.fetch("/sessions", {
586
501
  method: "POST",
587
- body: JSON.stringify(request)
502
+ body: JSON.stringify(payload)
588
503
  });
589
504
  return this.parseData(response, "/sessions");
590
505
  }
@@ -884,6 +799,9 @@ var PybClient = class {
884
799
  }
885
800
  }
886
801
  };
802
+ function createPybClient(config = {}) {
803
+ return new PybClient(config);
804
+ }
887
805
 
888
806
  // src/sse.ts
889
807
  var DEFAULT_CONNECT_TIMEOUT_MS = 1e4;
@@ -2563,7 +2481,7 @@ function isRecord4(value) {
2563
2481
  }
2564
2482
 
2565
2483
  // src/version.ts
2566
- var SDK_VERSION = "1.5.56";
2484
+ var SDK_VERSION = "1.5.57";
2567
2485
  export {
2568
2486
  BackendKindSchema,
2569
2487
  ContentBlockSchema,
@@ -2631,6 +2549,7 @@ export {
2631
2549
  canTransitionV2SessionStatus,
2632
2550
  createDefaultToolPermissionContextForSdk,
2633
2551
  createProtocolSessionBackend,
2552
+ createPybClient,
2634
2553
  createRuntimePermissionContextForSession,
2635
2554
  createRuntimeSession,
2636
2555
  createRuntimeSessionBackend,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pybao-xc-sdk",
3
- "version": "1.5.56",
3
+ "version": "1.5.57",
4
4
  "description": "PYB-CLI Server SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",