@vaiftech/client 1.0.3 → 1.0.5

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
@@ -2628,6 +2628,12 @@ interface Environment {
2628
2628
  id: string;
2629
2629
  projectId: string;
2630
2630
  name: string;
2631
+ type?: string;
2632
+ url?: string;
2633
+ customDomain?: string | null;
2634
+ customDomainVerified?: boolean;
2635
+ isActive?: boolean;
2636
+ config?: Record<string, unknown>;
2631
2637
  createdAt: string;
2632
2638
  updatedAt: string;
2633
2639
  }
@@ -4103,6 +4109,7 @@ interface CheckEntitlementResponse {
4103
4109
  interface CheckoutInput {
4104
4110
  orgId: string;
4105
4111
  plan: "starter" | "pro" | "agency" | "studio_plus";
4112
+ interval?: "monthly" | "yearly";
4106
4113
  successUrl?: string;
4107
4114
  cancelUrl?: string;
4108
4115
  }
@@ -4112,6 +4119,19 @@ interface CheckoutInput {
4112
4119
  interface CheckoutResponse {
4113
4120
  url: string;
4114
4121
  }
4122
+ /**
4123
+ * Checkout session verification response
4124
+ */
4125
+ interface CheckoutVerifyResponse {
4126
+ ok: boolean;
4127
+ status: "complete" | "expired" | "open";
4128
+ paymentStatus: "paid" | "unpaid" | "no_payment_required";
4129
+ plan: string;
4130
+ interval: string;
4131
+ subscriptionId: string | null;
4132
+ subscriptionStatus: string | null;
4133
+ currentPeriodEnd: string | null;
4134
+ }
4115
4135
  /**
4116
4136
  * Portal input
4117
4137
  */
@@ -4132,6 +4152,124 @@ interface PortalResponse {
4132
4152
  interface PlansResponse {
4133
4153
  plans: PlanDefinition[];
4134
4154
  }
4155
+ /**
4156
+ * AI usage summary for billing dashboard
4157
+ */
4158
+ interface AIUsageSummary {
4159
+ ok: boolean;
4160
+ plan: PlanName;
4161
+ periodStart: string;
4162
+ periodEnd: string;
4163
+ daysRemaining: number;
4164
+ creditsIncluded: number;
4165
+ creditsUsed: number;
4166
+ creditsRemaining: number;
4167
+ percentUsed: number;
4168
+ customBudgetCents: number | null;
4169
+ hardStopEnabled: boolean;
4170
+ overagesEnabled: boolean;
4171
+ dailyAverageCents: number;
4172
+ projectedMonthEndCents: number;
4173
+ withinBudget: boolean;
4174
+ aiEnabled: boolean;
4175
+ providersAllowed: string[];
4176
+ maxRequestTokens: number;
4177
+ maxOutputTokens: number;
4178
+ }
4179
+ /**
4180
+ * AI usage history entry (daily)
4181
+ */
4182
+ interface AIUsageHistoryEntry {
4183
+ date: string;
4184
+ requests: number;
4185
+ totalTokens: number;
4186
+ costCents: number;
4187
+ creditsCharged: number;
4188
+ }
4189
+ /**
4190
+ * AI usage history response
4191
+ */
4192
+ interface AIUsageHistoryResponse {
4193
+ ok: boolean;
4194
+ orgId: string;
4195
+ periodStart: string;
4196
+ periodEnd: string;
4197
+ history: AIUsageHistoryEntry[];
4198
+ }
4199
+ /**
4200
+ * AI usage breakdown item
4201
+ */
4202
+ interface AIUsageBreakdownItem {
4203
+ requests: number;
4204
+ totalTokens: number;
4205
+ costCents: number;
4206
+ creditsCharged: number;
4207
+ }
4208
+ /**
4209
+ * AI usage breakdown by feature
4210
+ */
4211
+ interface AIUsageByFeature extends AIUsageBreakdownItem {
4212
+ featureTag: string;
4213
+ }
4214
+ /**
4215
+ * AI usage breakdown by provider
4216
+ */
4217
+ interface AIUsageByProvider extends AIUsageBreakdownItem {
4218
+ provider: string;
4219
+ }
4220
+ /**
4221
+ * AI usage breakdown by model
4222
+ */
4223
+ interface AIUsageByModel extends AIUsageBreakdownItem {
4224
+ model: string;
4225
+ provider: string;
4226
+ }
4227
+ /**
4228
+ * AI usage breakdown response
4229
+ */
4230
+ interface AIUsageBreakdownResponse {
4231
+ ok: boolean;
4232
+ orgId: string;
4233
+ periodStart: string;
4234
+ periodEnd: string;
4235
+ byFeature: AIUsageByFeature[];
4236
+ byProvider: AIUsageByProvider[];
4237
+ byModel: AIUsageByModel[];
4238
+ }
4239
+ /**
4240
+ * Recent AI request
4241
+ */
4242
+ interface RecentAIRequest {
4243
+ id: string;
4244
+ projectId: string | null;
4245
+ userId: string | null;
4246
+ provider: string;
4247
+ model: string;
4248
+ taskType: string;
4249
+ featureTag: string | null;
4250
+ environment: string | null;
4251
+ promptTokens: number;
4252
+ completionTokens: number;
4253
+ totalTokens: number;
4254
+ costCents: number;
4255
+ creditsCharged: number;
4256
+ requestId: string | null;
4257
+ cached: boolean;
4258
+ createdAt: string;
4259
+ }
4260
+ /**
4261
+ * Recent AI requests response
4262
+ */
4263
+ interface RecentAIRequestsResponse {
4264
+ ok: boolean;
4265
+ orgId: string;
4266
+ requests: RecentAIRequest[];
4267
+ pagination: {
4268
+ limit: number;
4269
+ offset: number;
4270
+ total: number;
4271
+ };
4272
+ }
4135
4273
  /**
4136
4274
  * Billing module interface
4137
4275
  */
@@ -4156,10 +4294,30 @@ interface BillingModule {
4156
4294
  * Create a Stripe checkout session for upgrading
4157
4295
  */
4158
4296
  createCheckout(input: CheckoutInput): Promise<CheckoutResponse>;
4297
+ /**
4298
+ * Verify a checkout session after redirect (call this on billing page load with session_id param)
4299
+ */
4300
+ verifyCheckoutSession(sessionId: string): Promise<CheckoutVerifyResponse>;
4159
4301
  /**
4160
4302
  * Open Stripe billing portal for managing subscription
4161
4303
  */
4162
4304
  openPortal(input: PortalInput): Promise<PortalResponse>;
4305
+ /**
4306
+ * Get AI credits usage summary for billing dashboard
4307
+ */
4308
+ getAIUsageSummary(orgId: string): Promise<AIUsageSummary>;
4309
+ /**
4310
+ * Get AI usage history (daily) for charts
4311
+ */
4312
+ getAIUsageHistory(orgId: string, days?: number): Promise<AIUsageHistoryResponse>;
4313
+ /**
4314
+ * Get AI usage breakdown by feature, provider, and model
4315
+ */
4316
+ getAIUsageBreakdown(orgId: string): Promise<AIUsageBreakdownResponse>;
4317
+ /**
4318
+ * Get recent AI requests for detailed inspection
4319
+ */
4320
+ getRecentAIRequests(orgId: string, limit?: number, offset?: number): Promise<RecentAIRequestsResponse>;
4163
4321
  }
4164
4322
 
4165
4323
  /**
@@ -4535,6 +4693,43 @@ interface DLQListOptions {
4535
4693
  limit?: number;
4536
4694
  offset?: number;
4537
4695
  }
4696
+ /**
4697
+ * Feature flag
4698
+ */
4699
+ interface FeatureFlag$1 {
4700
+ id: string;
4701
+ key: string;
4702
+ enabled: boolean;
4703
+ createdAt: string;
4704
+ updatedAt: string;
4705
+ }
4706
+ /**
4707
+ * Admin user (super admin)
4708
+ */
4709
+ interface SuperAdmin {
4710
+ id: string;
4711
+ userId: string;
4712
+ role: string;
4713
+ permissions: string[];
4714
+ notes: string | null;
4715
+ isActive: boolean;
4716
+ lastAccessAt: string | null;
4717
+ createdAt: string;
4718
+ updatedAt: string;
4719
+ email?: string;
4720
+ name?: string;
4721
+ }
4722
+ /**
4723
+ * System setting
4724
+ */
4725
+ interface SystemSetting {
4726
+ key: string;
4727
+ value: unknown;
4728
+ category: string;
4729
+ description: string | null;
4730
+ isSecret: boolean;
4731
+ updatedAt: string | null;
4732
+ }
4538
4733
  /**
4539
4734
  * Admin module interface
4540
4735
  */
@@ -4633,6 +4828,41 @@ interface AdminModule {
4633
4828
  ok: boolean;
4634
4829
  messageId: string;
4635
4830
  }>;
4831
+ listFeatureFlags(): Promise<FeatureFlag$1[]>;
4832
+ createFeatureFlag(key: string, enabled: boolean): Promise<{
4833
+ ok: boolean;
4834
+ }>;
4835
+ updateFeatureFlag(key: string, enabled: boolean): Promise<{
4836
+ ok: boolean;
4837
+ }>;
4838
+ deleteFeatureFlag(key: string): Promise<{
4839
+ ok: boolean;
4840
+ key: string;
4841
+ }>;
4842
+ listAdmins(): Promise<SuperAdmin[]>;
4843
+ addAdmin(userId: string, role?: string, notes?: string): Promise<{
4844
+ ok: boolean;
4845
+ admin: SuperAdmin;
4846
+ }>;
4847
+ updateAdmin(adminId: string, data: {
4848
+ role?: string;
4849
+ permissions?: string[];
4850
+ isActive?: boolean;
4851
+ notes?: string;
4852
+ }): Promise<{
4853
+ ok: boolean;
4854
+ }>;
4855
+ removeAdmin(adminId: string): Promise<{
4856
+ ok: boolean;
4857
+ }>;
4858
+ getSettings(category?: string): Promise<{
4859
+ settings: Record<string, SystemSetting[]>;
4860
+ total: number;
4861
+ }>;
4862
+ updateSetting(key: string, value: unknown): Promise<{
4863
+ ok: boolean;
4864
+ key: string;
4865
+ }>;
4636
4866
  }
4637
4867
 
4638
4868
  /**
@@ -5050,6 +5280,348 @@ interface BudgetStatus {
5050
5280
  hardStop: boolean;
5051
5281
  percentUsed: number;
5052
5282
  }
5283
+ /**
5284
+ * AI model tiers
5285
+ */
5286
+ type AIModelTier = "free" | "paid" | "enterprise";
5287
+ /**
5288
+ * AI model provider
5289
+ */
5290
+ type AIModelProvider = "openai" | "anthropic";
5291
+ /**
5292
+ * Generation types supported by the AI workspace
5293
+ */
5294
+ type GenerationType = "schema" | "storage" | "functions" | "backend" | "fullstack";
5295
+ /**
5296
+ * Model capabilities
5297
+ */
5298
+ interface AIModelCapabilities {
5299
+ streaming: boolean;
5300
+ vision: boolean;
5301
+ toolUse: boolean;
5302
+ reasoning: boolean;
5303
+ codeGeneration: boolean;
5304
+ }
5305
+ /**
5306
+ * An AI model available in the platform
5307
+ */
5308
+ interface AIModel {
5309
+ id: string;
5310
+ provider: AIModelProvider;
5311
+ displayName: string;
5312
+ description: string;
5313
+ tier: AIModelTier;
5314
+ creditMultiplier: number;
5315
+ maxInputTokens: number;
5316
+ maxOutputTokens: number;
5317
+ capabilities: AIModelCapabilities;
5318
+ bestFor: string[];
5319
+ }
5320
+ /**
5321
+ * Available models response
5322
+ */
5323
+ interface AvailableModelsResult {
5324
+ models: AIModel[];
5325
+ recommended: {
5326
+ primary: string;
5327
+ reasoning: string;
5328
+ quick: string;
5329
+ };
5330
+ plan: string;
5331
+ modelTier: AIModelTier;
5332
+ maxContextTokens: number;
5333
+ }
5334
+ /**
5335
+ * Workspace session types
5336
+ */
5337
+ type WorkspaceSessionType = "backend_generation" | "schema_design" | "code_review";
5338
+ /**
5339
+ * Workspace session status
5340
+ */
5341
+ type WorkspaceSessionStatus = "active" | "completed" | "error" | "cancelled";
5342
+ /**
5343
+ * Turn types in a workspace session
5344
+ */
5345
+ type WorkspaceTurnType = "user_input" | "clarification" | "reasoning" | "generation";
5346
+ /**
5347
+ * A turn in a workspace session
5348
+ */
5349
+ interface WorkspaceTurn {
5350
+ id: string;
5351
+ sessionId: string;
5352
+ turnIndex: number;
5353
+ turnType: WorkspaceTurnType;
5354
+ inputContent?: string;
5355
+ reasoningContent?: string;
5356
+ outputContent?: string;
5357
+ generatedCode?: Record<string, string>;
5358
+ clarificationQuestions?: ClarificationQuestion[];
5359
+ clarificationResponses?: ClarificationResponses;
5360
+ inputTokens: number;
5361
+ outputTokens: number;
5362
+ creditsCharged: string;
5363
+ modelUsed?: string;
5364
+ durationMs?: number;
5365
+ status: string;
5366
+ createdAt: string;
5367
+ }
5368
+ /**
5369
+ * A workspace session
5370
+ */
5371
+ interface WorkspaceSession {
5372
+ id: string;
5373
+ projectId: string;
5374
+ userId: string;
5375
+ sessionType: WorkspaceSessionType;
5376
+ title?: string;
5377
+ description?: string;
5378
+ status: WorkspaceSessionStatus;
5379
+ generationConfig: Record<string, unknown>;
5380
+ contextSnapshot: ProjectContext;
5381
+ primaryModelId?: string;
5382
+ totalInputTokens: number;
5383
+ totalOutputTokens: number;
5384
+ totalCreditsUsed: string;
5385
+ outputArtifacts: Array<{
5386
+ type: string;
5387
+ id: string;
5388
+ }>;
5389
+ createdAt: string;
5390
+ updatedAt: string;
5391
+ completedAt?: string;
5392
+ }
5393
+ /**
5394
+ * Input for creating a workspace session
5395
+ */
5396
+ interface CreateWorkspaceSessionInput {
5397
+ projectId: string;
5398
+ sessionType: WorkspaceSessionType;
5399
+ title?: string;
5400
+ description?: string;
5401
+ primaryModelId?: string;
5402
+ generationConfig?: {
5403
+ framework?: "express" | "fastify" | "hono";
5404
+ language?: "typescript" | "javascript";
5405
+ packageManager?: "npm" | "yarn" | "pnpm" | "bun";
5406
+ };
5407
+ }
5408
+ /**
5409
+ * Input for submitting a prompt
5410
+ */
5411
+ interface SubmitPromptInput {
5412
+ prompt: string;
5413
+ modelId?: string;
5414
+ }
5415
+ /**
5416
+ * Clarification question types
5417
+ */
5418
+ type ClarificationQuestionType = "multiple_choice" | "text" | "boolean" | "multi_select";
5419
+ /**
5420
+ * Clarification categories
5421
+ */
5422
+ type ClarificationCategory = "architecture" | "features" | "data_model" | "auth" | "api_design" | "storage" | "realtime" | "deployment" | "integrations";
5423
+ /**
5424
+ * A clarification question
5425
+ */
5426
+ interface ClarificationQuestion {
5427
+ id: string;
5428
+ question: string;
5429
+ type: ClarificationQuestionType;
5430
+ category: ClarificationCategory;
5431
+ options?: string[];
5432
+ defaultValue?: string | string[];
5433
+ required: boolean;
5434
+ helpText?: string;
5435
+ }
5436
+ /**
5437
+ * User's responses to clarification questions
5438
+ */
5439
+ interface ClarificationResponses {
5440
+ [questionId: string]: string | string[] | boolean;
5441
+ }
5442
+ /**
5443
+ * Extracted requirements from a prompt
5444
+ */
5445
+ interface ExtractedRequirements {
5446
+ projectType?: string;
5447
+ features: string[];
5448
+ dataEntities: string[];
5449
+ authMethod?: string;
5450
+ apiStyle?: string;
5451
+ frameworks?: string[];
5452
+ integrations: string[];
5453
+ unclear: string[];
5454
+ }
5455
+ /**
5456
+ * Clarification analysis result
5457
+ */
5458
+ interface ClarificationAnalysisResult {
5459
+ needsClarification: boolean;
5460
+ confidence: "low" | "medium" | "high";
5461
+ questions: ClarificationQuestion[];
5462
+ extractedRequirements: ExtractedRequirements;
5463
+ suggestedApproach?: string;
5464
+ }
5465
+ /**
5466
+ * Submit prompt result
5467
+ */
5468
+ interface SubmitPromptResult {
5469
+ turn: WorkspaceTurn;
5470
+ needsClarification: boolean;
5471
+ questions: ClarificationQuestion[];
5472
+ suggestedApproach?: string;
5473
+ extractedRequirements: ExtractedRequirements;
5474
+ }
5475
+ /**
5476
+ * Submit clarification result
5477
+ */
5478
+ interface SubmitClarificationResult {
5479
+ turn: WorkspaceTurn;
5480
+ config: BackendGenerationConfig;
5481
+ readyToGenerate: boolean;
5482
+ }
5483
+ /**
5484
+ * Backend generation configuration
5485
+ */
5486
+ interface BackendGenerationConfig {
5487
+ framework: "express" | "fastify" | "hono";
5488
+ language: "typescript" | "javascript";
5489
+ packageManager: "npm" | "yarn" | "pnpm" | "bun";
5490
+ authMethod: "none" | "jwt" | "session" | "oauth" | "api_key";
5491
+ apiStyle: "rest" | "graphql" | "trpc";
5492
+ includeRealtime: boolean;
5493
+ features: {
5494
+ validation: boolean;
5495
+ errorHandling: boolean;
5496
+ logging: boolean;
5497
+ cors: boolean;
5498
+ rateLimit: boolean;
5499
+ tests: boolean;
5500
+ docker: boolean;
5501
+ };
5502
+ }
5503
+ /**
5504
+ * A generated backend
5505
+ */
5506
+ interface GeneratedBackend {
5507
+ id: string;
5508
+ projectId: string;
5509
+ sessionId?: string;
5510
+ userId: string;
5511
+ name: string;
5512
+ description?: string;
5513
+ framework: string;
5514
+ language: string;
5515
+ packageManager: string;
5516
+ files: Record<string, string>;
5517
+ fileCount: number;
5518
+ totalLines: number;
5519
+ connectionConfig: Record<string, unknown>;
5520
+ dependencies: Record<string, string>;
5521
+ devDependencies: Record<string, string>;
5522
+ status: "draft" | "ready" | "deployed";
5523
+ githubRepoUrl?: string;
5524
+ deployedUrl?: string;
5525
+ createdAt: string;
5526
+ updatedAt: string;
5527
+ }
5528
+ /**
5529
+ * Generate backend result
5530
+ */
5531
+ interface GenerateBackendResult {
5532
+ backend: GeneratedBackend;
5533
+ files: Array<{
5534
+ path: string;
5535
+ content: string;
5536
+ language: string;
5537
+ }>;
5538
+ totalLines: number;
5539
+ }
5540
+ /**
5541
+ * Input for generating a backend
5542
+ */
5543
+ interface GenerateBackendInput {
5544
+ name: string;
5545
+ config?: Partial<BackendGenerationConfig>;
5546
+ }
5547
+ /**
5548
+ * Project context for AI operations
5549
+ */
5550
+ interface ProjectContext {
5551
+ project: {
5552
+ id: string;
5553
+ name: string;
5554
+ slug: string;
5555
+ features: Record<string, boolean>;
5556
+ };
5557
+ schema: {
5558
+ tables: Array<{
5559
+ name: string;
5560
+ columns: Array<{
5561
+ name: string;
5562
+ type: string;
5563
+ nullable: boolean;
5564
+ }>;
5565
+ primaryKey: string[];
5566
+ foreignKeys: Array<{
5567
+ columns: string[];
5568
+ referencesTable: string;
5569
+ referencesColumns: string[];
5570
+ }>;
5571
+ }>;
5572
+ totalRelationships: number;
5573
+ };
5574
+ storage: {
5575
+ buckets: Array<{
5576
+ name: string;
5577
+ public: boolean;
5578
+ size?: number;
5579
+ }>;
5580
+ };
5581
+ functions: {
5582
+ list: Array<{
5583
+ name: string;
5584
+ description?: string;
5585
+ }>;
5586
+ totalFunctions: number;
5587
+ };
5588
+ tokenCounts: {
5589
+ schema: number;
5590
+ storage: number;
5591
+ functions: number;
5592
+ code: number;
5593
+ total: number;
5594
+ };
5595
+ }
5596
+ /**
5597
+ * Context summary
5598
+ */
5599
+ interface ContextSummary {
5600
+ tables: number;
5601
+ columns: number;
5602
+ relationships: number;
5603
+ buckets: number;
5604
+ functions: number;
5605
+ tokens: number;
5606
+ }
5607
+ /**
5608
+ * Get context result
5609
+ */
5610
+ interface GetContextResult {
5611
+ context: ProjectContext;
5612
+ summary: ContextSummary;
5613
+ formatted: string;
5614
+ tokenCounts: ProjectContext["tokenCounts"];
5615
+ }
5616
+ /**
5617
+ * Token estimation result
5618
+ */
5619
+ interface EstimateTokensResult {
5620
+ promptTokens: number;
5621
+ contextTokens: number;
5622
+ totalTokens: number;
5623
+ estimatedCost: number;
5624
+ }
5053
5625
  /**
5054
5626
  * AI module interface for the VAIF client
5055
5627
  */
@@ -5174,6 +5746,153 @@ interface AIModule {
5174
5746
  deleteConversation(conversationId: string): Promise<{
5175
5747
  ok: boolean;
5176
5748
  }>;
5749
+ /**
5750
+ * Get available AI models for the current user's plan
5751
+ *
5752
+ * @example
5753
+ * ```ts
5754
+ * const result = await vaif.ai.getAvailableModels();
5755
+ * console.log(result.models); // Available models
5756
+ * console.log(result.recommended); // Recommended models for different tasks
5757
+ * ```
5758
+ */
5759
+ getAvailableModels(): Promise<AvailableModelsResult>;
5760
+ /**
5761
+ * Get details for a specific model
5762
+ */
5763
+ getModel(modelId: string): Promise<{
5764
+ model: AIModel;
5765
+ }>;
5766
+ /**
5767
+ * Get full project context for AI operations
5768
+ *
5769
+ * @example
5770
+ * ```ts
5771
+ * const result = await vaif.ai.getProjectContext('proj_123');
5772
+ * console.log(result.summary); // { tables: 5, columns: 25, ... }
5773
+ * console.log(result.tokenCounts.total); // Total tokens used for context
5774
+ * ```
5775
+ */
5776
+ getProjectContext(projectId: string): Promise<GetContextResult>;
5777
+ /**
5778
+ * Estimate tokens for a prompt
5779
+ */
5780
+ estimateTokens(prompt: string, projectId?: string): Promise<EstimateTokensResult>;
5781
+ /**
5782
+ * Analyze a prompt and get clarification questions before generation
5783
+ *
5784
+ * @example
5785
+ * ```ts
5786
+ * const result = await vaif.ai.analyzeForClarification({
5787
+ * prompt: 'Create a chat application backend',
5788
+ * projectId: 'proj_123'
5789
+ * });
5790
+ * if (result.needsClarification) {
5791
+ * console.log(result.questions); // Questions to ask user
5792
+ * }
5793
+ * ```
5794
+ */
5795
+ analyzeForClarification(input: {
5796
+ prompt: string;
5797
+ projectId: string;
5798
+ }): Promise<ClarificationAnalysisResult>;
5799
+ /**
5800
+ * Get AI-generated prompt suggestions based on generation types
5801
+ *
5802
+ * @example
5803
+ * ```ts
5804
+ * const result = await vaif.ai.getSuggestions({
5805
+ * projectId: 'proj_123',
5806
+ * generationTypes: ['schema', 'backend']
5807
+ * });
5808
+ * console.log(result.suggestions); // Array of contextual prompt suggestions
5809
+ * ```
5810
+ */
5811
+ getSuggestions(input: {
5812
+ projectId: string;
5813
+ generationTypes: GenerationType[];
5814
+ }): Promise<{
5815
+ suggestions: string[];
5816
+ }>;
5817
+ /**
5818
+ * Create a new AI workspace session
5819
+ *
5820
+ * @example
5821
+ * ```ts
5822
+ * const result = await vaif.ai.workspace.create({
5823
+ * projectId: 'proj_123',
5824
+ * sessionType: 'backend_generation',
5825
+ * title: 'Chat App Backend'
5826
+ * });
5827
+ * console.log(result.session.id);
5828
+ * ```
5829
+ */
5830
+ workspace: {
5831
+ /**
5832
+ * Create a new workspace session
5833
+ */
5834
+ create(input: CreateWorkspaceSessionInput): Promise<{
5835
+ session: WorkspaceSession;
5836
+ }>;
5837
+ /**
5838
+ * Get a workspace session with its turns
5839
+ */
5840
+ get(sessionId: string): Promise<{
5841
+ session: WorkspaceSession;
5842
+ turns: WorkspaceTurn[];
5843
+ }>;
5844
+ /**
5845
+ * List workspace sessions for a project
5846
+ */
5847
+ list(projectId: string): Promise<{
5848
+ sessions: WorkspaceSession[];
5849
+ }>;
5850
+ /**
5851
+ * Submit a prompt to a workspace session
5852
+ */
5853
+ submitPrompt(sessionId: string, input: SubmitPromptInput): Promise<SubmitPromptResult>;
5854
+ /**
5855
+ * Submit clarification responses
5856
+ */
5857
+ submitClarification(sessionId: string, responses: ClarificationResponses): Promise<SubmitClarificationResult>;
5858
+ /**
5859
+ * Generate backend code for a session
5860
+ */
5861
+ generate(sessionId: string, input: GenerateBackendInput): Promise<GenerateBackendResult>;
5862
+ };
5863
+ /**
5864
+ * Generated backend operations
5865
+ */
5866
+ backends: {
5867
+ /**
5868
+ * Get a generated backend by ID
5869
+ */
5870
+ get(backendId: string): Promise<{
5871
+ backend: GeneratedBackend;
5872
+ }>;
5873
+ /**
5874
+ * List generated backends for a project
5875
+ */
5876
+ list(projectId: string): Promise<{
5877
+ backends: Array<{
5878
+ id: string;
5879
+ name: string;
5880
+ description?: string;
5881
+ framework: string;
5882
+ language: string;
5883
+ fileCount: number;
5884
+ totalLines: number;
5885
+ status: string;
5886
+ createdAt: string;
5887
+ }>;
5888
+ }>;
5889
+ /**
5890
+ * Delete a generated backend
5891
+ */
5892
+ delete(backendId: string): Promise<{
5893
+ ok: boolean;
5894
+ }>;
5895
+ };
5177
5896
  }
5178
5897
 
5179
5898
  /**