@sampleapp.ai/sdk 1.0.42 → 1.0.44

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.
Files changed (40) hide show
  1. package/dist/components/sandbox/Sandbox.js +96 -29
  2. package/dist/components/sandbox/api.js +73 -1
  3. package/dist/components/sandbox/guardian/code-focus-section.js +4 -2
  4. package/dist/components/sandbox/guardian/context/theme-context.js +47 -0
  5. package/dist/components/sandbox/guardian/demo/guardian-demo.js +4 -4
  6. package/dist/components/sandbox/guardian/demo/left-view.js +13 -7
  7. package/dist/components/sandbox/guardian/guardian-component.js +39 -8
  8. package/dist/components/sandbox/guardian/guardian-playground.js +14 -15
  9. package/dist/components/sandbox/guardian/guardian-style-wrapper.js +8 -6
  10. package/dist/components/sandbox/guardian/header.js +37 -41
  11. package/dist/components/sandbox/guardian/hooks/use-frame-messages.js +24 -8
  12. package/dist/components/sandbox/guardian/hooks/use-frame-params.js +94 -36
  13. package/dist/components/sandbox/guardian/hooks/use-sandbox-url-loader.js +16 -4
  14. package/dist/components/sandbox/guardian/index.js +2 -0
  15. package/dist/components/sandbox/guardian/right-view/pill-file-selector.js +70 -20
  16. package/dist/components/sandbox/guardian/right-view/preview-control-bar.js +5 -2
  17. package/dist/components/sandbox/guardian/right-view/right-top-down-view/network-requests-view.js +117 -0
  18. package/dist/components/sandbox/guardian/right-view/right-top-down-view.js +38 -140
  19. package/dist/components/sandbox/guardian/right-view/right-view.js +3 -3
  20. package/dist/components/sandbox/guardian/right-view/simplified-editor.js +9 -2
  21. package/dist/components/sandbox/guardian/ui/markdown/code-group/code-block.js +7 -33
  22. package/dist/components/sandbox/guardian/ui/markdown.js +23 -14
  23. package/dist/components/sandbox/guardian/utils.js +4 -16
  24. package/dist/components/sandbox/sandbox-home/SandboxCard.js +7 -5
  25. package/dist/components/sandbox/sandbox-home/SandboxHome.js +32 -13
  26. package/dist/components/sandbox/sandbox-home/SearchBar.js +5 -3
  27. package/dist/hooks/use-tree-selector.js +98 -0
  28. package/dist/index.d.ts +631 -21
  29. package/dist/index.es.js +22806 -22028
  30. package/dist/index.js +13 -4
  31. package/dist/index.standalone.umd.js +8 -8
  32. package/dist/lib/api-client.js +68 -0
  33. package/dist/lib/content-matcher.js +99 -0
  34. package/dist/lib/generated-css.js +1 -1
  35. package/dist/lib/shadow-dom-wrapper.js +31 -10
  36. package/dist/lib/tree-utils.js +193 -0
  37. package/dist/lib/types/tree-config.js +36 -0
  38. package/dist/sdk.css +1 -1
  39. package/dist/tailwind.css +2 -2
  40. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -8,6 +8,150 @@ export declare interface AiChatSettings {
8
8
  [key: string]: any;
9
9
  }
10
10
 
11
+ /**
12
+ * Main API client class
13
+ */
14
+ declare class ApiClient {
15
+ private baseUrl;
16
+ private apiKey;
17
+ constructor(config: ApiClientConfig);
18
+ /**
19
+ * Makes a request to the API
20
+ * Automatically includes Authorization: Bearer {apiKey} header
21
+ */
22
+ private request;
23
+ /**
24
+ * Sandbox content endpoints
25
+ */
26
+ sandboxContent: {
27
+ /**
28
+ * Get public sandbox content by UID
29
+ * @param sandboxContentUid - The UID of the sandbox content
30
+ * @returns The sandbox content data
31
+ */
32
+ getPublic: (sandboxContentUid: string) => Promise<SandboxContent>;
33
+ /**
34
+ * Get all sandbox contents for a specific playground (public access with truncated fields)
35
+ * @param playgroundUid - The UID of the playground
36
+ * @param skip - Number of records to skip (default: 0)
37
+ * @param limit - Maximum number of records to return (default: 100)
38
+ * @returns Array of sandbox content data with only uid and markdown fields
39
+ */
40
+ getByPlayground: (playgroundUid: string, skip?: number, limit?: number) => Promise<SandboxContentPublic[]>;
41
+ /**
42
+ * Get all sandbox contents for a specific use case
43
+ * Used for upfront loading to enable local filtering
44
+ * @param useCaseId - The ID of the use case
45
+ * @param skip - Number of records to skip (default: 0)
46
+ * @param limit - Maximum number of records to return (default: 100)
47
+ * @returns Array of sandbox content data
48
+ */
49
+ getByUseCaseId: (useCaseId: number, skip?: number, limit?: number) => Promise<SandboxContent[]>;
50
+ };
51
+ /**
52
+ * Sandbox use case endpoints
53
+ */
54
+ sandboxUseCase: {
55
+ /**
56
+ * Get a sandbox use case by UID
57
+ * @param uid - The UID of the use case
58
+ * @returns The use case data including tech_stack_config
59
+ */
60
+ getByUid: (uid: string) => Promise<SandboxUseCase>;
61
+ /**
62
+ * Get a sandbox use case by ID
63
+ * @param id - The numeric ID of the use case
64
+ * @returns The use case data including tech_stack_config
65
+ */
66
+ getById: (id: number) => Promise<SandboxUseCase>;
67
+ /**
68
+ * Get all sandbox use cases for a specific playground
69
+ * @param playgroundUid - The UID of the playground
70
+ * @param skip - Number of records to skip (default: 0)
71
+ * @param limit - Maximum number of records to return (default: 100)
72
+ * @returns Array of use case data
73
+ */
74
+ getByPlayground: (playgroundUid: string, skip?: number, limit?: number) => Promise<SandboxUseCase[]>;
75
+ /**
76
+ * Get all template use cases (public access)
77
+ * @param skip - Number of records to skip (default: 0)
78
+ * @param limit - Maximum number of records to return (default: 100)
79
+ * @returns Array of template use case data
80
+ */
81
+ getTemplates: (skip?: number, limit?: number) => Promise<SandboxUseCase[]>;
82
+ /**
83
+ * Get all public use cases
84
+ * @param skip - Number of records to skip (default: 0)
85
+ * @param limit - Maximum number of records to return (default: 100)
86
+ * @returns Array of public use case data
87
+ */
88
+ getPublic: (skip?: number, limit?: number) => Promise<SandboxUseCase[]>;
89
+ };
90
+ /**
91
+ * SDK endpoints
92
+ */
93
+ sdk: {
94
+ /**
95
+ * Start a sandbox
96
+ *
97
+ * Authentication: API key is sent as Bearer token in Authorization header.
98
+ * The apiKey must be set in ApiClientConfig when creating the client.
99
+ *
100
+ * @param request - The start sandbox request (env and chatUid)
101
+ * @returns The sandbox response with container URL
102
+ *
103
+ * @example
104
+ * ```typescript
105
+ * const client = createApiClient({ apiKey: "your-api-key" });
106
+ * const response = await client.sdk.startSandbox({
107
+ * env: { ENV_VAR: "value" }, // required when published_url is not available
108
+ * chatUid: "chat-uid-123"
109
+ * });
110
+ * ```
111
+ */
112
+ startSandbox: (request: StartSandboxRequest) => Promise<StartSandboxResponse>;
113
+ /**
114
+ * Download code as zip file from GitHub repository
115
+ *
116
+ * Authentication: API key is sent as Bearer token in Authorization header.
117
+ * The apiKey must be set in ApiClientConfig when creating the client.
118
+ *
119
+ * @param sandboxId - The sandbox content UID
120
+ * @returns Promise that resolves when download is initiated
121
+ */
122
+ downloadCode: (sandboxId: string) => Promise<void>;
123
+ /**
124
+ * Start VM endpoint that starts a desktop sandbox, launches Chrome,
125
+ * navigates to the target URL, and returns a VNC viewer URL
126
+ *
127
+ * Authentication: API key is sent as Bearer token in Authorization header.
128
+ * The apiKey must be set in ApiClientConfig when creating the client.
129
+ *
130
+ * @param request - The start VM request with url, optional mode, and optional resolution
131
+ * @returns The sandbox response with sandboxId and vncUrl (if mode=json)
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * const client = createApiClient({ apiKey: "your-api-key" });
136
+ * const response = await client.sdk.startVm({
137
+ * url: "https://example.com",
138
+ * mode: "json",
139
+ * resolution: [1920, 1080]
140
+ * });
141
+ * ```
142
+ */
143
+ startVm: (request: StartVmRequest) => Promise<StartVmResponse>;
144
+ };
145
+ }
146
+
147
+ export declare interface ApiClientConfig {
148
+ /**
149
+ * API key for authentication. Will be sent as Bearer token in Authorization header.
150
+ * Required for all authenticated endpoints.
151
+ */
152
+ apiKey: string;
153
+ }
154
+
11
155
  export declare interface BaseSettings {
12
156
  apiKey: string;
13
157
  primaryBrandColor: string;
@@ -15,6 +159,11 @@ export declare interface BaseSettings {
15
159
  [key: string]: any;
16
160
  }
17
161
 
162
+ /**
163
+ * Build SandboxConfig from any SandboxContent (for switching between selections)
164
+ */
165
+ export declare function buildConfigFromContent(content: SandboxContent): SandboxConfig;
166
+
18
167
  /**
19
168
  * Builds a nested GuardianConfig from use cases with nested frameworks.
20
169
  * Returns a structure where config[useCaseId].frameworks[frameworkKey] gives you the full config.
@@ -117,8 +266,77 @@ declare interface CodeOutput {
117
266
  full_code: string;
118
267
  }
119
268
 
269
+ /**
270
+ * Create an API client instance
271
+ *
272
+ * @param config - Configuration for the API client
273
+ * @param config.apiKey - API key for authentication (sent as Bearer token in Authorization header)
274
+ * @returns An API client instance
275
+ *
276
+ * @example
277
+ * ```typescript
278
+ * // Create client with API key
279
+ * const client = createApiClient({
280
+ * apiKey: process.env.NEXT_PUBLIC_SAMPLEAPP_API_KEY
281
+ * });
282
+ *
283
+ * // All requests will automatically include: Authorization: Bearer {apiKey}
284
+ * ```
285
+ */
286
+ export declare function createApiClient(config: ApiClientConfig): ApiClient;
287
+
288
+ /**
289
+ * Create a TreeSelection object from a path
290
+ */
291
+ export declare function createSelection(config: TechStackConfig, path: string[]): TreeSelection;
292
+
120
293
  export declare const DEFAULT_THEME: ThemeName;
121
294
 
295
+ /**
296
+ * Extract container ID from a browser URL
297
+ * @param browserUrl - URL like "https://nextjs-a3fcd2bb-2a15-4f9b-bd13-aeac52baebd2.sampleapp.love/?_ts=1767897000670"
298
+ * @returns Container ID like "nextjs-a3fcd2bb-2a15-4f9b-bd13-aeac52baebd2" or null if not found
299
+ */
300
+ export declare function extractContainerIdFromUrl(browserUrl: string): string | null;
301
+
302
+ /**
303
+ * Fetches sandbox configuration from the API (legacy method)
304
+ * @param apiKey - API key from SandboxProps
305
+ * @param sandboxId - Sandbox content UID (maps to sandbox_content_uid)
306
+ * @returns Sandbox configuration
307
+ * @deprecated Use fetchSandboxConfigWithContent for tree-based selection
308
+ */
309
+ export declare function fetchSandboxConfig(apiKey: string, sandboxId: string): Promise<SandboxConfig>;
310
+
311
+ /**
312
+ * Fetches sandbox configuration with all content for upfront loading
313
+ * This enables instant switching between tech stack options without API calls
314
+ *
315
+ * @param apiKey - API key from SandboxProps
316
+ * @param sandboxId - Sandbox content UID (maps to sandbox_content_uid)
317
+ * @returns Extended sandbox configuration with all content
318
+ */
319
+ export declare function fetchSandboxConfigWithContent(apiKey: string, sandboxId: string): Promise<SandboxConfigWithContent>;
320
+
321
+ /**
322
+ * Filter content entries by multiple criteria
323
+ *
324
+ * @param allContent - All sandbox content entries
325
+ * @param filters - Object with field names and values to filter by
326
+ * @returns Filtered array of content entries
327
+ */
328
+ export declare function filterContent(allContent: SandboxContent[], filters: Partial<Pick<SandboxContent, "product" | "product_version" | "architecture" | "frontend" | "backend" | "framework">>): SandboxContent[];
329
+
330
+ /**
331
+ * Find sandbox content that matches the current tree selection
332
+ * Matches against flat fields: product, product_version, architecture, frontend, backend, framework
333
+ *
334
+ * @param allContent - All sandbox content entries for the use case
335
+ * @param selection - Current tree selection
336
+ * @returns Matching content or null if not found
337
+ */
338
+ export declare function findMatchingContent(allContent: SandboxContent[], selection: TreeSelection): SandboxContent | null;
339
+
122
340
  export declare enum Framework {
123
341
  FLASK = "flask",
124
342
  EXPRESS = "express",
@@ -129,29 +347,70 @@ export declare enum Framework {
129
347
  FASTMCP = "fastmcp"
130
348
  }
131
349
 
350
+ /**
351
+ * Get the default path through the tree (following isDefault flags or first child)
352
+ * @param root - The root node
353
+ * @returns Array of keys representing the default selection path
354
+ */
355
+ export declare function getDefaultPath(root: TreeNode): string[];
356
+
357
+ /**
358
+ * Navigate the tree to find a node at a specific path
359
+ * @param root - The root node to start from
360
+ * @param path - Array of keys to follow
361
+ * @returns The node at the path, or null if not found
362
+ */
363
+ export declare function getNodeAtPath(root: TreeNode, path: string[]): TreeNode | null;
364
+
365
+ /**
366
+ * Get the display label for a node (falls back to key if no label)
367
+ */
368
+ export declare function getNodeLabel(node: TreeNode): string;
369
+
370
+ /**
371
+ * Get all nodes along a path (including the root)
372
+ * @param root - The root node
373
+ * @param path - Array of keys to follow
374
+ * @returns Array of nodes from root to the final node
375
+ */
376
+ export declare function getNodesAlongPath(root: TreeNode, path: string[]): TreeNode[];
377
+
378
+ /**
379
+ * Get selectable sections based on current selection path
380
+ * This builds the button groups shown in the header
381
+ * @param config - The tech stack configuration
382
+ * @param currentPath - Current selection path
383
+ * @returns Array of sections with their options
384
+ */
385
+ export declare function getSelectableSections(config: TechStackConfig, currentPath: string[]): SelectorSection[];
386
+
132
387
  export declare const getTheme: (themeName?: ThemeName) => ThemeColors;
133
388
 
134
- export declare function GuardianComponent({ demoOptions, frameworkOptions, firstFrameworkByUseCase, currentFramework, currentUseCase, CustomConsole, GuideView, playgroundLogo, playgroundUid, browserUrl, useVm, sandboxUid, codeZipFile, completeCodeZipFile, variant, themeColor, hasPreview, isFrame, apiKey, env, chatUid, hideHeader, // Hardcoded to true by default, not exposed in Sandbox.tsx
135
- gitUrl, }: GuardianComponentProps): default_2.JSX.Element;
389
+ /**
390
+ * Get all unique values for a specific field from content entries
391
+ * Useful for building filter options
392
+ *
393
+ * @param allContent - All sandbox content entries
394
+ * @param field - The field to extract unique values from
395
+ * @returns Array of unique non-null values
396
+ */
397
+ export declare function getUniqueFieldValues(allContent: SandboxContent[], field: keyof Pick<SandboxContent, "product" | "product_version" | "architecture" | "frontend" | "backend" | "framework">): string[];
398
+
399
+ export declare function GuardianComponent({ sections, onSelect, currentFramework, currentUseCase, CustomConsole, GuideView, playgroundLogo, playgroundUid, browserUrl, useVm, sandboxUid, codeZipFile, completeCodeZipFile, variant, themeColor, hasPreview, isFrame, apiKey, env, chatUid, hideHeader, // Hardcoded to true by default, not exposed in Sandbox.tsx
400
+ gitUrl, hasNetworkView, stationaryPublishedUrl }: GuardianComponentProps): default_2.JSX.Element;
136
401
 
137
402
  export declare interface GuardianComponentProps {
138
403
  name: string;
139
404
  description: string;
140
- demoOptions: {
141
- label: string;
142
- value: string;
143
- }[];
144
- frameworkOptions: {
145
- label: string;
146
- value: string;
147
- }[];
405
+ /** Dynamic sections from useTreeSelector hook */
406
+ sections: SelectorSection[];
407
+ /** Handler when user selects an option */
408
+ onSelect: (nodeType: string, key: string) => void;
148
409
  CustomConsole: default_2.ComponentType<{
149
410
  onReloadPreview: () => void;
150
411
  onStageChange: (stage: "hidden" | "error" | "rebuilding") => void;
151
412
  themeColor: string;
152
413
  }> | string;
153
- /** Maps use case ID to first available framework key */
154
- firstFrameworkByUseCase?: Record<string, string>;
155
414
  /** The current framework key for this sandbox */
156
415
  currentFramework: string;
157
416
  /** The current use case ID (for nested config navigation) */
@@ -186,6 +445,10 @@ export declare interface GuardianComponentProps {
186
445
  /* Excluded from this release type: hideHeader */
187
446
  /** Optional Git URL for opening the project in VSCode */
188
447
  gitUrl?: string;
448
+ /** Whether to show the network requests view tab */
449
+ hasNetworkView?: boolean;
450
+ /** When true, keeps the first browserUrl per use case (prevents URL changes when toggling options) */
451
+ stationaryPublishedUrl?: boolean;
189
452
  }
190
453
 
191
454
  /**
@@ -231,17 +494,25 @@ declare interface GuardianFrameworkConfig extends Omit<GuardianComponentProps, '
231
494
  export declare type GuardianNestedConfig = Record<string, GuardianUseCaseConfig>;
232
495
 
233
496
  /**
234
- * Guardian Playground component with nested config structure.
235
- * Expects config[useCaseId].frameworks[frameworkKey] structure.
497
+ * Guardian Playground component with tree-based tech stack selection.
498
+ * Uses sections from useTreeSelector for dynamic header rendering.
236
499
  *
237
- * When isFrame=true, reads framework from URL params client-side.
500
+ * Note: Frame param overrides for node types (architecture, frontend, backend, etc.)
501
+ * are now handled in Sandbox.tsx via the tree selector sync mechanism.
502
+ * This component receives the already-resolved framework from the tree selector.
238
503
  */
239
- export declare function GuardianPlayground({ nestedConfig, useCase, framework: serverFramework, isFrame, apiKey, env, chatUid, theme, }: {
240
- /** Nested config structure (use case → framework → config) */
241
- nestedConfig: GuardianNestedConfig;
504
+ export declare function GuardianPlayground({ sandboxConfig, sections, onSelect, useCase, framework, isFrame, apiKey, env, chatUid, theme, hasNetworkView, stationaryPublishedUrl }: GuardianPlaygroundProps): default_2.JSX.Element;
505
+
506
+ declare interface GuardianPlaygroundProps {
507
+ /** Sandbox configuration */
508
+ sandboxConfig: SandboxConfig;
509
+ /** Dynamic sections from useTreeSelector hook */
510
+ sections: SelectorSection[];
511
+ /** Handler when user selects an option */
512
+ onSelect: (nodeType: string, key: string) => void;
242
513
  /** Current use case ID */
243
514
  useCase: string;
244
- /** Current framework key (from server-side props) */
515
+ /** Current framework key (from tree selector) */
245
516
  framework: string;
246
517
  /** Whether to render in frame mode (just the right view) */
247
518
  isFrame?: boolean;
@@ -253,7 +524,11 @@ export declare function GuardianPlayground({ nestedConfig, useCase, framework: s
253
524
  chatUid?: string;
254
525
  /** Theme mode - "light", "dark", or "system". Defaults to "dark" */
255
526
  theme?: ThemeMode;
256
- }): default_2.JSX.Element;
527
+ /** Whether to show the network requests view tab */
528
+ hasNetworkView?: boolean;
529
+ /** When true, keeps the first browserUrl per use case (prevents URL changes when toggling options) */
530
+ stationaryPublishedUrl?: boolean;
531
+ }
257
532
 
258
533
  export declare function GuardianProvider({ children }: {
259
534
  children: ReactNode;
@@ -296,6 +571,40 @@ export declare interface GuardianUseCaseConfig {
296
571
  frameworks: Record<string, GuardianFrameworkConfig>;
297
572
  }
298
573
 
574
+ /**
575
+ * Check if content exists for a potential selection
576
+ * Used to disable/gray out options that have no content
577
+ *
578
+ * @param allContent - All sandbox content entries for the use case
579
+ * @param partialSelection - Partial selection to check (only specified fields are matched)
580
+ * @returns True if at least one content entry matches
581
+ */
582
+ export declare function hasContentForSelection(allContent: SandboxContent[], partialSelection: Partial<TreeSelection["byType"]>): boolean;
583
+
584
+ /**
585
+ * Header component for dynamic tech stack selection
586
+ *
587
+ * Uses sections from useTreeSelector to render selector buttons
588
+ * based on the tech_stack_config tree structure.
589
+ */
590
+ export declare function Header({ sections, onSelect, playgroundLogo, themecolor }: HeaderProps): default_2.JSX.Element;
591
+
592
+ export declare interface HeaderProps {
593
+ /** Dynamic sections from useTreeSelector hook */
594
+ sections: SelectorSection[];
595
+ /** Handler when user selects an option */
596
+ onSelect: (nodeType: string, key: string) => void;
597
+ /** Optional playground logo */
598
+ playgroundLogo?: default_2.ReactNode;
599
+ /** Theme color for selected state */
600
+ themecolor?: string;
601
+ }
602
+
603
+ /**
604
+ * Check if a path is complete (reaches a leaf node)
605
+ */
606
+ export declare function isPathComplete(config: TechStackConfig, path: string[]): boolean;
607
+
299
608
  export declare const ModalSearchAndChat: default_2.FC<ModalSearchAndChatProps>;
300
609
 
301
610
  declare interface ModalSearchAndChatProps {
@@ -303,6 +612,29 @@ declare interface ModalSearchAndChatProps {
303
612
  onClose?: () => void;
304
613
  }
305
614
 
615
+ /**
616
+ * Human-readable labels for node types
617
+ */
618
+ export declare const NODE_TYPE_LABELS: Record<string, string>;
619
+
620
+ /**
621
+ * All supported node types for tech stack selection
622
+ */
623
+ export declare const NODE_TYPES: readonly ["root", "product", "version", "architecture", "frontend", "backend", "framework", "integration", "platform"];
624
+
625
+ /**
626
+ * Type for node types
627
+ */
628
+ export declare type NodeType = (typeof NODE_TYPES)[number];
629
+
630
+ /**
631
+ * Convert a path to a byType map
632
+ * @param root - The root node
633
+ * @param path - Array of keys
634
+ * @returns Map of nodeType to selected key
635
+ */
636
+ export declare function pathToByType(root: TreeNode, path: string[]): Record<string, string>;
637
+
306
638
  declare class SampleAppSDK {
307
639
  ModalSearchAndChat: (settings: SDKSettings, container?: HTMLElement) => {
308
640
  unmount: () => void;
@@ -342,7 +674,102 @@ declare class SampleAppSDK {
342
674
  * />
343
675
  * ```
344
676
  */
345
- export declare function Sandbox({ apiKey, sandboxId, env, themeColor, theme, }: SandboxProps): default_2.JSX.Element | null;
677
+ /**
678
+ *
679
+ * Configurations for the config param
680
+ * {
681
+ * isFrame: boolean;
682
+ * }
683
+ *
684
+ *
685
+ */
686
+ export declare function Sandbox({ apiKey, sandboxId, env, themeColor, theme, config }: SandboxProps): default_2.JSX.Element | null;
687
+
688
+ /**
689
+ * Configuration fetched from the API for a sandbox
690
+ */
691
+ declare interface SandboxConfig {
692
+ /** Sandbox identifier */
693
+ id: string;
694
+ /** Display name */
695
+ name: string;
696
+ /** Description */
697
+ description: string;
698
+ /** Theme color */
699
+ themeColor: string;
700
+ /** Whether preview is available */
701
+ hasPreview: boolean;
702
+ /** Optional playground logo */
703
+ playgroundLogo?: React.ReactNode;
704
+ /**
705
+ * Chat UID for starting the sandbox via API.
706
+ * NOTE: This is only used as a fallback when published_url is not available.
707
+ * If published_url exists in the framework config, it takes precedence and chatUid is not needed.
708
+ */
709
+ chatUid?: string;
710
+ /** List of use cases with frameworks */
711
+ useCases: GuardianUseCase[];
712
+ }
713
+
714
+ /**
715
+ * Configuration options for the Sandbox component
716
+ */
717
+ declare interface SandboxConfigOptions {
718
+ /** Whether to render in frame mode (just the right view) */
719
+ isFrame?: boolean;
720
+ /** Whether to show the network requests view tab. Defaults to false */
721
+ hasNetworkView?: boolean;
722
+ /** Whether to keep the first browserUrl per use case (prevents URL changes when toggling options) */
723
+ stationaryPublishedUrl?: boolean;
724
+ }
725
+
726
+ /**
727
+ * Extended sandbox configuration with tree-based tech stack selection
728
+ */
729
+ export declare interface SandboxConfigWithContent {
730
+ /** The use case containing the tech stack config */
731
+ useCase: SandboxUseCase;
732
+ /** Parsed tech stack configuration tree */
733
+ techStackConfig: TechStackConfig;
734
+ /** ALL sandbox content entries for this use case (for local filtering) */
735
+ allContent: SandboxContent[];
736
+ /** The initially requested sandbox content */
737
+ initialContent: SandboxContent;
738
+ /** Initial selection path from the content */
739
+ initialSelectionPath: string[];
740
+ /** Legacy config for backward compatibility */
741
+ legacyConfig: SandboxConfig;
742
+ }
743
+
744
+ export declare interface SandboxContent {
745
+ id: number;
746
+ uid: string;
747
+ use_case_id: number;
748
+ product: string | null;
749
+ product_version: string | null;
750
+ architecture: string | null;
751
+ frontend: string | null;
752
+ backend: string | null;
753
+ framework: string | null;
754
+ selection_path: string[] | null;
755
+ markdown: string | null;
756
+ github_url: string | null;
757
+ published_url: string | null;
758
+ is_vm_enabled: boolean;
759
+ generated_code_id: number | null;
760
+ generated_code?: UpdateContainerCodebaseType | null;
761
+ chat_uid: string | null;
762
+ playground_uid: string | null;
763
+ user_id: string | null;
764
+ has_preview: boolean;
765
+ created_at: string;
766
+ updated_at: string;
767
+ }
768
+
769
+ export declare interface SandboxContentPublic {
770
+ uid: string;
771
+ markdown: string | null;
772
+ }
346
773
 
347
774
  export declare const SandboxHome: React_2.FC<SandboxHomeProps>;
348
775
 
@@ -351,6 +778,7 @@ export declare interface SandboxHomeProps {
351
778
  orgid: string;
352
779
  sandboxes?: SandboxItem[];
353
780
  basePath?: string;
781
+ theme?: ThemeMode;
354
782
  }
355
783
 
356
784
  export declare interface SandboxItem {
@@ -378,6 +806,21 @@ export declare interface SandboxProps {
378
806
  themeColor?: string;
379
807
  /** Theme mode - "light", "dark", or "system". Defaults to "dark" */
380
808
  theme?: ThemeMode;
809
+ /** Configuration options for the sandbox */
810
+ config?: SandboxConfigOptions;
811
+ }
812
+
813
+ export declare interface SandboxUseCase {
814
+ id: number;
815
+ uid: string;
816
+ name: string;
817
+ description: string | null;
818
+ tech_stack_config: Record<string, any>;
819
+ playground_uid: string | null;
820
+ is_public: boolean;
821
+ is_template: boolean;
822
+ created_at: string;
823
+ updated_at: string;
381
824
  }
382
825
 
383
826
  declare const sdk: SampleAppSDK;
@@ -388,6 +831,68 @@ export declare interface SDKSettings {
388
831
  aiChatSettings?: AiChatSettings;
389
832
  }
390
833
 
834
+ /**
835
+ * Selectable node types (excludes "root" which is not user-selectable)
836
+ */
837
+ export declare const SELECTABLE_NODE_TYPES: Exclude<NodeType, "root">[];
838
+
839
+ /**
840
+ * A single option within a selector section
841
+ */
842
+ export declare interface SelectorOption {
843
+ /** Unique key for this option */
844
+ key: string;
845
+ /** Display label */
846
+ label: string;
847
+ /** Whether this option is currently selected */
848
+ isSelected: boolean;
849
+ /** Whether this option has content available (for disabling unavailable options) */
850
+ hasContent?: boolean;
851
+ /** Whether this option is a leaf node (has no children) */
852
+ isLeaf?: boolean;
853
+ }
854
+
855
+ /**
856
+ * A section of the selector (e.g., "Architecture:", "Frontend:", "Backend:")
857
+ */
858
+ export declare interface SelectorSection {
859
+ /** The nodeType this section represents */
860
+ nodeType: string;
861
+ /** Display label for this section (e.g., "Architecture:") */
862
+ label: string;
863
+ /** Available options in this section */
864
+ options: SelectorOption[];
865
+ }
866
+
867
+ declare interface StartSandboxRequest {
868
+ /**
869
+ * Environment variables to pass to the sandbox.
870
+ * Required when published_url is not available (when starting a new sandbox).
871
+ * Optional when published_url exists (sandbox already exists).
872
+ */
873
+ env?: Record<string, any>;
874
+ /** Chat UID for starting the sandbox */
875
+ chatUid: string;
876
+ }
877
+
878
+ declare interface StartSandboxResponse {
879
+ container_url: string;
880
+ }
881
+
882
+ declare interface StartVmRequest {
883
+ /** Target URL to navigate to in Chrome */
884
+ url: string;
885
+ /** Response mode: 'redirect' or 'json' (default: 'json') */
886
+ mode?: "redirect" | "json";
887
+ /** Desktop resolution [width, height] in pixels */
888
+ resolution?: [number, number];
889
+ }
890
+
891
+ declare interface StartVmResponse {
892
+ sandboxId: string;
893
+ vncUrl: string;
894
+ }
895
+
391
896
  export declare const TailwindExample: React_2.FC<TailwindExampleProps>;
392
897
 
393
898
  export declare interface TailwindExampleProps {
@@ -395,6 +900,13 @@ export declare interface TailwindExampleProps {
395
900
  description?: string;
396
901
  }
397
902
 
903
+ /**
904
+ * Root structure of the tech stack configuration
905
+ */
906
+ export declare interface TechStackConfig {
907
+ root: TreeNode;
908
+ }
909
+
398
910
  export declare interface ThemeColors {
399
911
  primary: string;
400
912
  shadow: {
@@ -434,8 +946,106 @@ export declare type ThemeName = "ocean" | "autumn" | "mint" | "sunset" | "lavend
434
946
 
435
947
  export declare const themes: Record<ThemeName, ThemeColors>;
436
948
 
949
+ /**
950
+ * Tree configuration types for dynamic tech stack selection
951
+ * Matches the tech_stack_config structure from SandboxUseCase
952
+ */
953
+ /**
954
+ * A node in the tech stack tree
955
+ */
956
+ export declare interface TreeNode {
957
+ /** Unique key for this node (e.g., "javascript-sdk", "react", "node.js") */
958
+ key: string;
959
+ /** Human-readable label (defaults to key if not provided) */
960
+ label?: string;
961
+ /** Type of this node - determines which selector group it belongs to */
962
+ nodeType: string;
963
+ /** Child nodes (next level of selection) */
964
+ children?: TreeNode[];
965
+ /** Whether this is the default selection at this level */
966
+ isDefault?: boolean;
967
+ /** Optional metadata for this node */
968
+ metadata?: Record<string, unknown>;
969
+ }
970
+
971
+ /**
972
+ * Current selection state in the tree
973
+ */
974
+ export declare interface TreeSelection {
975
+ /** Array of selected keys from root to leaf (e.g., ["javascript-sdk", "react", "node.js"]) */
976
+ path: string[];
977
+ /** Map of nodeType to selected key (e.g., { architecture: "javascript-sdk", frontend: "react", backend: "node.js" }) */
978
+ byType: Record<string, string>;
979
+ }
980
+
437
981
  declare type UpdateContainerCodebaseType = Record<string, CodeOutput>;
438
982
 
983
+ /**
984
+ * Update the selection path when a user selects an option
985
+ * @param config - The tech stack configuration
986
+ * @param currentPath - Current selection path
987
+ * @param nodeType - The nodeType of the selection being changed
988
+ * @param selectedKey - The key of the newly selected option
989
+ * @returns New selection path
990
+ */
991
+ export declare function updateSelectionPath(config: TechStackConfig, currentPath: string[], nodeType: string, selectedKey: string): string[];
992
+
993
+ /**
994
+ * Hook for managing tree-based tech stack selection
995
+ *
996
+ * @example
997
+ * ```tsx
998
+ * const { selection, sections, currentContent, selectOption } = useTreeSelector({
999
+ * config: techStackConfig,
1000
+ * allContent: sandboxContents,
1001
+ * initialPath: ["javascript-sdk", "react", "node.js"],
1002
+ * });
1003
+ *
1004
+ * // Render sections
1005
+ * {sections.map(section => (
1006
+ * <div key={section.nodeType}>
1007
+ * <span>{section.label}</span>
1008
+ * {section.options.map(opt => (
1009
+ * <button
1010
+ * key={opt.key}
1011
+ * onClick={() => selectOption(section.nodeType, opt.key)}
1012
+ * className={opt.isSelected ? "selected" : ""}
1013
+ * >
1014
+ * {opt.label}
1015
+ * </button>
1016
+ * ))}
1017
+ * </div>
1018
+ * ))}
1019
+ * ```
1020
+ */
1021
+ export declare function useTreeSelector({ config, allContent, initialPath, onSelectionChange }: UseTreeSelectorOptions): UseTreeSelectorReturn;
1022
+
1023
+ export declare interface UseTreeSelectorOptions {
1024
+ /** The tech stack configuration tree */
1025
+ config: TechStackConfig;
1026
+ /** All sandbox content entries for this use case (for local filtering) */
1027
+ allContent: SandboxContent[];
1028
+ /** Initial selection path (from URL or saved state) */
1029
+ initialPath?: string[];
1030
+ /** Callback when selection changes */
1031
+ onSelectionChange?: (selection: TreeSelection, content: SandboxContent | null) => void;
1032
+ }
1033
+
1034
+ export declare interface UseTreeSelectorReturn {
1035
+ /** Current selection state */
1036
+ selection: TreeSelection;
1037
+ /** Sections to render in the UI (button groups) */
1038
+ sections: SelectorSection[];
1039
+ /** Currently matched content based on selection */
1040
+ currentContent: SandboxContent | null;
1041
+ /** Handler for when user selects an option */
1042
+ selectOption: (nodeType: string, key: string) => void;
1043
+ /** Reset to default selection */
1044
+ resetToDefault: () => void;
1045
+ /** Set selection from a path */
1046
+ setSelectionPath: (path: string[]) => void;
1047
+ }
1048
+
439
1049
  export declare const VmProvider: ({ children }: {
440
1050
  children: ReactNode;
441
1051
  }) => default_2.JSX.Element;