@vaiftech/client 1.0.10 → 1.0.11

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
@@ -2632,11 +2632,76 @@ interface Environment {
2632
2632
  url?: string;
2633
2633
  customDomain?: string | null;
2634
2634
  customDomainVerified?: boolean;
2635
+ customDomainCnameVerified?: boolean;
2636
+ customDomainSslStatus?: "pending" | "provisioning" | "active" | "failed" | null;
2637
+ customDomainSslExpiresAt?: string | null;
2635
2638
  isActive?: boolean;
2636
2639
  config?: Record<string, unknown>;
2637
2640
  createdAt: string;
2638
2641
  updatedAt: string;
2639
2642
  }
2643
+ /**
2644
+ * Domain status response
2645
+ */
2646
+ interface DomainStatus {
2647
+ configured: boolean;
2648
+ customDomain: string | null;
2649
+ status: "pending" | "txt_verified" | "cname_verified" | "ssl_provisioning" | "active" | "failed" | null;
2650
+ txtVerification?: {
2651
+ verified: boolean;
2652
+ host: string;
2653
+ value: string;
2654
+ };
2655
+ cnameVerification?: {
2656
+ verified: boolean;
2657
+ host: string;
2658
+ target: string;
2659
+ };
2660
+ ssl?: {
2661
+ status: string | null;
2662
+ expiresAt: string | null;
2663
+ };
2664
+ autoUrl?: string;
2665
+ }
2666
+ /**
2667
+ * Domain verification instructions
2668
+ */
2669
+ interface DomainVerificationInstructions {
2670
+ customDomain: string;
2671
+ verified: boolean;
2672
+ verificationToken: string;
2673
+ instructions: {
2674
+ method: string;
2675
+ host: string;
2676
+ value: string;
2677
+ ttl: number;
2678
+ note: string;
2679
+ };
2680
+ cnameInstructions: {
2681
+ method: string;
2682
+ host: string;
2683
+ value: string;
2684
+ ttl: number;
2685
+ note: string;
2686
+ };
2687
+ }
2688
+ /**
2689
+ * Domain verification result
2690
+ */
2691
+ interface DomainVerificationResult {
2692
+ verified: boolean;
2693
+ message: string;
2694
+ cnameTarget?: string;
2695
+ }
2696
+ /**
2697
+ * SSL provisioning result
2698
+ */
2699
+ interface SslProvisioningResult {
2700
+ status: "provisioning" | "active";
2701
+ message: string;
2702
+ estimatedTime?: string;
2703
+ expiresAt?: string;
2704
+ }
2640
2705
  /**
2641
2706
  * Create project input
2642
2707
  */
@@ -2687,14 +2752,22 @@ interface CreateApiKeyResponse {
2687
2752
  apiKeyId: string;
2688
2753
  apiKey: string;
2689
2754
  }
2755
+ /**
2756
+ * Options for listing projects
2757
+ */
2758
+ interface ListProjectsOptions {
2759
+ /** Filter by organization ID */
2760
+ orgId?: string;
2761
+ }
2690
2762
  /**
2691
2763
  * Projects module interface
2692
2764
  */
2693
2765
  interface ProjectsModule {
2694
2766
  /**
2695
2767
  * List all projects for the authenticated user
2768
+ * @param options Optional filters (orgId)
2696
2769
  */
2697
- list(): Promise<Project[]>;
2770
+ list(options?: ListProjectsOptions): Promise<Project[]>;
2698
2771
  /**
2699
2772
  * Get a single project by ID
2700
2773
  */
@@ -2723,6 +2796,42 @@ interface ProjectsModule {
2723
2796
  * Rotate an API key
2724
2797
  */
2725
2798
  rotateApiKey(projectId: string, keyId: string): Promise<CreateApiKeyResponse>;
2799
+ /**
2800
+ * Set a custom domain for an environment
2801
+ */
2802
+ setCustomDomain(projectId: string, envId: string, domain: string | null): Promise<{
2803
+ environment: Environment;
2804
+ }>;
2805
+ /**
2806
+ * Get domain verification instructions
2807
+ */
2808
+ getDomainVerificationInstructions(projectId: string, envId: string): Promise<DomainVerificationInstructions>;
2809
+ /**
2810
+ * Verify TXT record for custom domain
2811
+ */
2812
+ verifyDomainTxt(projectId: string, envId: string): Promise<DomainVerificationResult>;
2813
+ /**
2814
+ * Verify CNAME record for custom domain
2815
+ */
2816
+ verifyDomainCname(projectId: string, envId: string): Promise<DomainVerificationResult>;
2817
+ /**
2818
+ * Get full domain status
2819
+ */
2820
+ getDomainStatus(projectId: string, envId: string): Promise<DomainStatus>;
2821
+ /**
2822
+ * Provision SSL certificate for custom domain
2823
+ */
2824
+ provisionSsl(projectId: string, envId: string): Promise<SslProvisioningResult>;
2825
+ /**
2826
+ * Remove custom domain from an environment
2827
+ */
2828
+ removeCustomDomain(projectId: string, envId: string): Promise<{
2829
+ environment: Environment;
2830
+ }>;
2831
+ /**
2832
+ * List all API keys for a project
2833
+ */
2834
+ listApiKeys(projectId: string): Promise<ApiKey[]>;
2726
2835
  }
2727
2836
 
2728
2837
  /**
@@ -5096,6 +5205,120 @@ interface TrainingDataExportResponse {
5096
5205
  includeSuccessful: boolean;
5097
5206
  };
5098
5207
  }
5208
+ /**
5209
+ * AI Workspace Session
5210
+ */
5211
+ interface AdminAIWorkspaceSession {
5212
+ id: string;
5213
+ projectId: string;
5214
+ userId: string;
5215
+ title: string | null;
5216
+ taskType: string | null;
5217
+ status: string;
5218
+ messageCount: number;
5219
+ totalTokens: number;
5220
+ totalCostCents: number;
5221
+ createdAt: string;
5222
+ updatedAt: string;
5223
+ userEmail: string | null;
5224
+ userName: string | null;
5225
+ projectName: string | null;
5226
+ }
5227
+ interface AdminAIWorkspaceMessage {
5228
+ id: string;
5229
+ conversationId: string;
5230
+ role: string;
5231
+ content: string;
5232
+ metadata: Record<string, any>;
5233
+ tokenCount: number;
5234
+ costCents: number;
5235
+ createdAt: string;
5236
+ }
5237
+ interface AdminAIWorkspaceOverview {
5238
+ overview: {
5239
+ totalSessions: number;
5240
+ sessions24h: number;
5241
+ totalMessages: number;
5242
+ messages24h: number;
5243
+ totalTokens: number;
5244
+ totalCostCents: number;
5245
+ sessionsByStatus: Record<string, number>;
5246
+ sessionsByTaskType: Record<string, number>;
5247
+ };
5248
+ trends: {
5249
+ dailySessions: Array<{
5250
+ date: string;
5251
+ count: number;
5252
+ }>;
5253
+ };
5254
+ }
5255
+ interface AdminAIWorkspaceSessionDetails {
5256
+ session: AdminAIWorkspaceSession & {
5257
+ context: Record<string, any>;
5258
+ };
5259
+ messages: AdminAIWorkspaceMessage[];
5260
+ }
5261
+ /**
5262
+ * API Error Log
5263
+ */
5264
+ interface AdminApiError {
5265
+ id: string;
5266
+ requestId: string | null;
5267
+ method: string;
5268
+ path: string;
5269
+ userId: string | null;
5270
+ projectId: string | null;
5271
+ orgId: string | null;
5272
+ errorCode: string | null;
5273
+ errorMessage: string;
5274
+ errorStack: string | null;
5275
+ requestBody: Record<string, unknown> | null;
5276
+ responseStatus: number;
5277
+ metadata: Record<string, unknown>;
5278
+ environment: string;
5279
+ serverRegion: string | null;
5280
+ createdAt: string;
5281
+ resolvedAt: string | null;
5282
+ resolvedBy: string | null;
5283
+ resolutionNotes: string | null;
5284
+ userName?: string | null;
5285
+ userEmail?: string | null;
5286
+ projectName?: string | null;
5287
+ orgName?: string | null;
5288
+ }
5289
+ /**
5290
+ * Error log list options
5291
+ */
5292
+ interface AdminErrorListOptions extends AdminListOptions {
5293
+ path?: string;
5294
+ errorCode?: string;
5295
+ status?: "unresolved" | "resolved" | "all";
5296
+ environment?: string;
5297
+ startDate?: string;
5298
+ endDate?: string;
5299
+ }
5300
+ /**
5301
+ * Error stats response
5302
+ */
5303
+ interface AdminErrorStats {
5304
+ total: number;
5305
+ unresolved: number;
5306
+ resolved: number;
5307
+ last24h: number;
5308
+ last7d: number;
5309
+ byErrorCode: Array<{
5310
+ errorCode: string;
5311
+ count: number;
5312
+ }>;
5313
+ byPath: Array<{
5314
+ path: string;
5315
+ count: number;
5316
+ }>;
5317
+ byResponseStatus: Array<{
5318
+ status: number;
5319
+ count: number;
5320
+ }>;
5321
+ }
5099
5322
  /**
5100
5323
  * Training data stats response
5101
5324
  */
@@ -5400,6 +5623,36 @@ interface AdminModule {
5400
5623
  }>;
5401
5624
  exportTrainingData(options?: TrainingDataExportOptions): Promise<TrainingDataExportResponse>;
5402
5625
  getTrainingDataStats(): Promise<TrainingDataStats>;
5626
+ listErrors(options?: AdminErrorListOptions): Promise<{
5627
+ errors: AdminApiError[];
5628
+ total: number;
5629
+ }>;
5630
+ getErrorStats(): Promise<AdminErrorStats>;
5631
+ getError(errorId: string): Promise<{
5632
+ error: AdminApiError;
5633
+ }>;
5634
+ resolveError(errorId: string, notes?: string): Promise<{
5635
+ ok: boolean;
5636
+ }>;
5637
+ deleteError(errorId: string): Promise<{
5638
+ ok: boolean;
5639
+ }>;
5640
+ bulkDeleteErrors(olderThanDays?: number): Promise<{
5641
+ ok: boolean;
5642
+ deletedCount: number;
5643
+ }>;
5644
+ getAIWorkspaceOverview(): Promise<AdminAIWorkspaceOverview>;
5645
+ listAIWorkspaceSessions(options?: AdminListOptions & {
5646
+ status?: string;
5647
+ taskType?: string;
5648
+ }): Promise<{
5649
+ sessions: AdminAIWorkspaceSession[];
5650
+ total: number;
5651
+ }>;
5652
+ getAIWorkspaceSession(sessionId: string): Promise<AdminAIWorkspaceSessionDetails>;
5653
+ deleteAIWorkspaceSession(sessionId: string): Promise<{
5654
+ ok: boolean;
5655
+ }>;
5403
5656
  }
5404
5657
 
5405
5658
  /**
@@ -6422,6 +6675,17 @@ interface AIModule {
6422
6675
  * Submit a modification request to existing generated code
6423
6676
  */
6424
6677
  submitModification(sessionId: string, input: SubmitModificationInput): Promise<SubmitModificationResult>;
6678
+ /**
6679
+ * Submit feedback for a workspace turn
6680
+ */
6681
+ submitFeedback(sessionId: string, input: {
6682
+ messageId: string;
6683
+ feedbackType: "correct" | "incorrect" | "partial";
6684
+ correctedIntent?: string;
6685
+ userFeedback?: string;
6686
+ }): Promise<{
6687
+ ok: boolean;
6688
+ }>;
6425
6689
  };
6426
6690
  /**
6427
6691
  * Generated backend operations
@@ -6477,6 +6741,143 @@ interface AIModule {
6477
6741
  status: string;
6478
6742
  };
6479
6743
  }>;
6744
+ /**
6745
+ * Apply a generated backend to an EXISTING VAIF project
6746
+ * Unlike deploy which creates a new project, this applies schema/storage/functions to current project
6747
+ * Also saves generated code to a versioned storage bucket
6748
+ */
6749
+ apply(backendId: string, input: {
6750
+ projectId: string;
6751
+ }): Promise<{
6752
+ ok: boolean;
6753
+ project: {
6754
+ id: string;
6755
+ name: string;
6756
+ orgId: string;
6757
+ slug: string;
6758
+ };
6759
+ backend: {
6760
+ id: string;
6761
+ name: string;
6762
+ status: string;
6763
+ };
6764
+ schemaApplied: boolean;
6765
+ schemaError: string | null;
6766
+ storageApplied: boolean;
6767
+ storageError: string | null;
6768
+ bucketsCreated: number;
6769
+ functionsApplied: boolean;
6770
+ functionsError: string | null;
6771
+ functionsCreated: number;
6772
+ /** Whether generated code was saved to storage */
6773
+ codeSaved: boolean;
6774
+ /** Error if code save failed */
6775
+ codeError: string | null;
6776
+ /** Storage path where code was saved (e.g., ai-generated-code/2024-01-15_backend-name) */
6777
+ codeStoragePath: string | null;
6778
+ }>;
6779
+ /**
6780
+ * Deploy a generated backend to Cloud Run (live deployment)
6781
+ */
6782
+ deployLive(backendId: string, config: {
6783
+ environment: "preview" | "staging" | "production";
6784
+ region?: string;
6785
+ memory?: string;
6786
+ cpu?: string;
6787
+ minInstances?: number;
6788
+ maxInstances?: number;
6789
+ }): Promise<{
6790
+ ok: boolean;
6791
+ deploymentId: string;
6792
+ status: string;
6793
+ buildId?: string;
6794
+ message?: string;
6795
+ }>;
6796
+ /**
6797
+ * Get all deployments for a backend
6798
+ */
6799
+ getDeployments(backendId: string): Promise<{
6800
+ deployments: Array<{
6801
+ id: string;
6802
+ deployId: string;
6803
+ environment: string;
6804
+ region: string;
6805
+ status: string;
6806
+ url?: string;
6807
+ gcpServiceName?: string;
6808
+ resources: Record<string, unknown>;
6809
+ errorMessage?: string;
6810
+ createdAt: string;
6811
+ deployedAt?: string;
6812
+ terminatedAt?: string;
6813
+ }>;
6814
+ }>;
6815
+ };
6816
+ /**
6817
+ * Live deployment operations (Cloud Run)
6818
+ */
6819
+ deployments: {
6820
+ /**
6821
+ * Get deployment limits for a project based on plan
6822
+ */
6823
+ getLimits(projectId: string): Promise<{
6824
+ ok: boolean;
6825
+ plan: string;
6826
+ limits: {
6827
+ enabled: boolean;
6828
+ maxDeployments: number;
6829
+ memoryOptions: string[];
6830
+ cpuOptions: string[];
6831
+ maxInstances: number;
6832
+ };
6833
+ activeDeployments: number;
6834
+ canDeploy: boolean;
6835
+ }>;
6836
+ /**
6837
+ * Get deployment status
6838
+ */
6839
+ getStatus(deploymentId: string): Promise<{
6840
+ deploymentId: string;
6841
+ status: "pending" | "building" | "deploying" | "active" | "failed" | "terminated";
6842
+ url?: string;
6843
+ buildProgress?: number;
6844
+ buildStatus?: string;
6845
+ serviceStatus?: string;
6846
+ logs?: string[];
6847
+ error?: string;
6848
+ deployedAt?: string;
6849
+ }>;
6850
+ /**
6851
+ * Get deployment logs
6852
+ */
6853
+ getLogs(deploymentId: string, options?: {
6854
+ limit?: number;
6855
+ severity?: string;
6856
+ }): Promise<{
6857
+ logs: Array<{
6858
+ timestamp: string;
6859
+ severity: string;
6860
+ message: string;
6861
+ resource?: string;
6862
+ }>;
6863
+ source: "build" | "runtime" | "stored";
6864
+ }>;
6865
+ /**
6866
+ * Terminate a deployment
6867
+ */
6868
+ terminate(deploymentId: string): Promise<{
6869
+ ok: boolean;
6870
+ message?: string;
6871
+ }>;
6872
+ /**
6873
+ * Redeploy an existing deployment
6874
+ */
6875
+ redeploy(deploymentId: string): Promise<{
6876
+ ok: boolean;
6877
+ deploymentId: string;
6878
+ status: string;
6879
+ message?: string;
6880
+ }>;
6480
6881
  };
6481
6882
  /**
6482
6883
  * Get user's organizations for deploy selection