@tangle-network/sandbox-ui 0.9.0 → 0.10.1

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/pages.js CHANGED
@@ -310,6 +310,16 @@ var STACK_DISPLAY = {
310
310
  rust: { name: "Rust", abbr: "Rs", color: "orange", textClass: "text-[var(--surface-orange-text)]" }
311
311
  };
312
312
  function resolveEnvironment(env) {
313
+ if (env.id.startsWith("template:")) {
314
+ const templateName = env.description?.replace(/^Template:\s*/, "") ?? "Custom Template";
315
+ return {
316
+ id: env.id,
317
+ name: templateName,
318
+ description: env.description ?? "User template from snapshot",
319
+ icon: /* @__PURE__ */ jsx2("span", { className: "text-[var(--surface-success-text)] text-2xl font-bold", children: "T" }),
320
+ color: "green"
321
+ };
322
+ }
313
323
  const display = STACK_DISPLAY[env.id];
314
324
  const name = display?.name ?? (env.id.length > 0 ? env.id.charAt(0).toUpperCase() + env.id.slice(1).replace(/-/g, " ") : "Unknown");
315
325
  const abbr = display?.abbr ?? (env.id.length > 0 ? env.id[0].toUpperCase() : "?");
@@ -334,8 +344,8 @@ var RAM_MIN = 2;
334
344
  var RAM_MAX = 32;
335
345
  var STORAGE_MIN = 20;
336
346
  var STORAGE_MAX = 512;
337
- function calcCost(cpu, ram) {
338
- const cost = cpu * 0.045 + ram * 5e-3;
347
+ function calcCost(cpu, ram, storage) {
348
+ const cost = cpu * 0.045 + ram * 5e-3 + storage * 11e-4;
339
349
  return cost.toFixed(2);
340
350
  }
341
351
  function ProvisioningWizard({
@@ -348,8 +358,12 @@ function ProvisioningWizard({
348
358
  defaultEnvironment,
349
359
  defaultConfig,
350
360
  skipToReview,
351
- onLoadStartupScripts
361
+ onLoadStartupScripts,
362
+ resourceLimits
352
363
  }) {
364
+ const cpuMax = Math.max(CPU_MIN, Math.min(resourceLimits?.cpuMax ?? CPU_MAX, CPU_MAX));
365
+ const ramMax = Math.max(RAM_MIN, Math.min(resourceLimits?.ramMaxGB ?? RAM_MAX, RAM_MAX));
366
+ const storageMax = Math.max(STORAGE_MIN, Math.min(resourceLimits?.storageMaxGB ?? STORAGE_MAX, STORAGE_MAX));
353
367
  const dc = defaultConfig;
354
368
  const [envList, setEnvList] = React2.useState(environmentsProp ?? defaultEnvironments);
355
369
  const onLoadEnvironmentsRef = React2.useRef(onLoadEnvironments);
@@ -377,9 +391,14 @@ function ProvisioningWizard({
377
391
  setSelectedEnv(effectiveDefault);
378
392
  }
379
393
  }, [envList, effectiveDefault]);
380
- const [cpuCores, setCpuCores] = React2.useState(dc?.cpuCores ?? 4);
381
- const [ramGB, setRamGB] = React2.useState(dc?.ramGB ?? 16);
382
- const [storageGB, setStorageGB] = React2.useState(dc?.storageGB ?? 128);
394
+ const [cpuCores, setCpuCores] = React2.useState(Math.min(dc?.cpuCores ?? 4, cpuMax));
395
+ const [ramGB, setRamGB] = React2.useState(Math.min(dc?.ramGB ?? 16, ramMax));
396
+ const [storageGB, setStorageGB] = React2.useState(Math.min(dc?.storageGB ?? 128, storageMax));
397
+ React2.useEffect(() => {
398
+ setCpuCores((prev) => Math.min(prev, cpuMax));
399
+ setRamGB((prev) => Math.min(prev, ramMax));
400
+ setStorageGB((prev) => Math.min(prev, storageMax));
401
+ }, [cpuMax, ramMax, storageMax]);
383
402
  const [modelTier, setModelTier] = React2.useState(dc?.modelTier ?? "claude-sonnet");
384
403
  const [systemPrompt, setSystemPrompt] = React2.useState(dc?.systemPrompt ?? "");
385
404
  const [name, setName] = React2.useState(dc?.name ?? "");
@@ -389,6 +408,7 @@ function ProvisioningWizard({
389
408
  const [bare, setBare] = React2.useState(dc?.bare ?? false);
390
409
  const [startupScriptIds, setStartupScriptIds] = React2.useState(dc?.startupScriptIds ?? []);
391
410
  const [availableScripts, setAvailableScripts] = React2.useState([]);
411
+ const [activePreset, setActivePreset] = React2.useState(null);
392
412
  const [showAdvanced, setShowAdvanced] = React2.useState(false);
393
413
  const [loadError, setLoadError] = React2.useState(null);
394
414
  const onLoadStartupScriptsRef = React2.useRef(onLoadStartupScripts);
@@ -423,12 +443,18 @@ function ProvisioningWizard({
423
443
  setIsDeploying(false);
424
444
  }
425
445
  };
426
- const applyPreset = (cpu, ram, storage) => {
427
- setCpuCores(cpu);
428
- setRamGB(ram);
429
- setStorageGB(storage);
446
+ const applyPreset = (name2, cpu, ram, storage) => {
447
+ setCpuCores(Math.min(cpu, cpuMax));
448
+ setRamGB(Math.min(ram, ramMax));
449
+ setStorageGB(Math.min(storage, storageMax));
450
+ setActivePreset(name2);
430
451
  };
431
- const hourCost = calcCost(cpuCores, ramGB);
452
+ const presets = [
453
+ { name: "Lightweight", cpu: Math.min(2, cpuMax), ram: Math.min(4, ramMax), storage: Math.min(50, storageMax) },
454
+ { name: "Standard", cpu: Math.min(4, cpuMax), ram: Math.min(16, ramMax), storage: Math.min(128, storageMax) },
455
+ { name: "Performance", cpu: Math.min(8, cpuMax), ram: Math.min(32, ramMax), storage: Math.min(256, storageMax) }
456
+ ];
457
+ const hourCost = calcCost(cpuCores, ramGB, storageGB);
432
458
  return /* @__PURE__ */ jsxs2("div", { className: cn("max-w-6xl mx-auto flex flex-col", className), children: [
433
459
  /* @__PURE__ */ jsxs2("div", { className: "mb-6 flex items-center gap-4 shrink-0", children: [
434
460
  onBack && /* @__PURE__ */ jsx2("button", { type: "button", onClick: onBack, className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border border-border hover:bg-muted/50 transition-colors text-foreground", children: /* @__PURE__ */ jsx2(ArrowLeft, { className: "h-5 w-5" }) }),
@@ -463,9 +489,9 @@ function ProvisioningWizard({
463
489
  onClick: () => {
464
490
  setCurrentStep(1);
465
491
  setSelectedEnv(environments[0]?.id ?? "");
466
- setCpuCores(4);
467
- setRamGB(16);
468
- setStorageGB(128);
492
+ setCpuCores(Math.min(4, cpuMax));
493
+ setRamGB(Math.min(16, ramMax));
494
+ setStorageGB(Math.min(128, storageMax));
469
495
  setModelTier("claude-sonnet");
470
496
  setSystemPrompt("");
471
497
  setName("");
@@ -474,6 +500,7 @@ function ProvisioningWizard({
474
500
  setDriver("docker");
475
501
  setBare(false);
476
502
  setStartupScriptIds([]);
503
+ setActivePreset(null);
477
504
  },
478
505
  className: "text-xs font-bold text-primary hover:text-primary/70 transition-colors",
479
506
  children: "Start from scratch"
@@ -522,25 +549,25 @@ function ProvisioningWizard({
522
549
  ] }),
523
550
  /* @__PURE__ */ jsxs2("div", { className: "mb-6", children: [
524
551
  /* @__PURE__ */ jsx2("label", { className: "block font-label text-xs font-bold uppercase tracking-widest text-muted-foreground mb-3", children: "Compute Presets" }),
525
- /* @__PURE__ */ jsxs2("div", { className: "grid grid-cols-3 gap-3", children: [
526
- /* @__PURE__ */ jsxs2("button", { type: "button", onClick: () => applyPreset(2, 4, 50), className: cn("p-3 rounded-[14px] transition-all duration-200 text-center group border", cpuCores === 2 && ramGB === 4 && storageGB === 50 ? "bg-primary/5 border-primary ring-1 ring-primary/20 shadow-sm" : "bg-card border-border hover:border-primary/30 hover:shadow-sm active:scale-[0.97]"), children: [
527
- /* @__PURE__ */ jsx2("div", { className: cn("font-bold text-sm transition-colors duration-200", cpuCores === 2 && ramGB === 4 && storageGB === 50 ? "text-primary" : "text-foreground"), children: "Lightweight" }),
528
- /* @__PURE__ */ jsx2("div", { className: "text-xs text-muted-foreground mt-0.5 font-mono", children: "2C / 4G / 50G" })
529
- ] }),
530
- /* @__PURE__ */ jsxs2("button", { type: "button", onClick: () => applyPreset(4, 16, 128), className: cn("p-3 rounded-[14px] transition-all duration-200 text-center group border", cpuCores === 4 && ramGB === 16 && storageGB === 128 ? "bg-primary/5 border-primary ring-1 ring-primary/20 shadow-sm" : "bg-card border-border hover:border-primary/30 hover:shadow-sm active:scale-[0.97]"), children: [
531
- /* @__PURE__ */ jsx2("div", { className: cn("font-bold text-sm transition-colors duration-200", cpuCores === 4 && ramGB === 16 && storageGB === 128 ? "text-primary" : "text-foreground"), children: "Standard" }),
532
- /* @__PURE__ */ jsx2("div", { className: "text-xs text-muted-foreground mt-0.5 font-mono", children: "4C / 16G / 128G" })
533
- ] }),
534
- /* @__PURE__ */ jsxs2("button", { type: "button", onClick: () => applyPreset(8, 32, 256), className: cn("p-3 rounded-[14px] transition-all duration-200 text-center group border", cpuCores === 8 && ramGB === 32 && storageGB === 256 ? "bg-primary/5 border-primary ring-1 ring-primary/20 shadow-sm" : "bg-card border-border hover:border-primary/30 hover:shadow-sm active:scale-[0.97]"), children: [
535
- /* @__PURE__ */ jsx2("div", { className: cn("font-bold text-sm transition-colors duration-200", cpuCores === 8 && ramGB === 32 && storageGB === 256 ? "text-primary" : "text-foreground"), children: "Performance" }),
536
- /* @__PURE__ */ jsx2("div", { className: "text-xs text-muted-foreground mt-0.5 font-mono", children: "8C / 32G / 256G" })
537
- ] })
538
- ] })
552
+ /* @__PURE__ */ jsx2("div", { className: "grid grid-cols-3 gap-3", children: presets.map((p) => {
553
+ const active = activePreset === p.name;
554
+ return /* @__PURE__ */ jsxs2("button", { type: "button", onClick: () => applyPreset(p.name, p.cpu, p.ram, p.storage), className: cn("p-3 rounded-[14px] transition-all duration-200 text-center group border", active ? "bg-primary/5 border-primary ring-1 ring-primary/20 shadow-sm" : "bg-card border-border hover:border-primary/30 hover:shadow-sm active:scale-[0.97]"), children: [
555
+ /* @__PURE__ */ jsx2("div", { className: cn("font-bold text-sm transition-colors duration-200", active ? "text-primary" : "text-foreground"), children: p.name }),
556
+ /* @__PURE__ */ jsxs2("div", { className: "text-xs text-muted-foreground mt-0.5 font-mono", children: [
557
+ p.cpu,
558
+ "C / ",
559
+ p.ram,
560
+ "G / ",
561
+ p.storage,
562
+ "G"
563
+ ] })
564
+ ] }, p.name);
565
+ }) })
539
566
  ] }),
540
567
  /* @__PURE__ */ jsx2("div", { className: "space-y-6", children: [
541
- { label: "Compute Cores (CPU)", value: cpuCores, setter: setCpuCores, min: CPU_MIN, max: CPU_MAX, step: 0.5, unit: "vCPUs" },
542
- { label: "Memory (RAM)", value: ramGB, setter: setRamGB, min: RAM_MIN, max: RAM_MAX, step: 1, unit: "GB" },
543
- { label: "Ephemeral Storage", value: storageGB, setter: setStorageGB, min: STORAGE_MIN, max: STORAGE_MAX, step: 8, unit: "GB" }
568
+ { label: "Compute Cores (CPU)", value: cpuCores, setter: setCpuCores, min: CPU_MIN, max: cpuMax, step: 0.5, unit: "vCPUs" },
569
+ { label: "Memory (RAM)", value: ramGB, setter: setRamGB, min: RAM_MIN, max: ramMax, step: 1, unit: "GB" },
570
+ { label: "Ephemeral Storage", value: storageGB, setter: setStorageGB, min: STORAGE_MIN, max: storageMax, step: 8, unit: "GB" }
544
571
  ].map(({ label, value, setter, min, max, step: s, unit }) => /* @__PURE__ */ jsxs2("div", { children: [
545
572
  /* @__PURE__ */ jsxs2("div", { className: "flex justify-between items-end border-b border-border pb-1.5 mb-2", children: [
546
573
  /* @__PURE__ */ jsx2("label", { className: "font-label text-xs font-bold uppercase tracking-widest text-muted-foreground", children: label }),
@@ -558,7 +585,10 @@ function ProvisioningWizard({
558
585
  max,
559
586
  step: s,
560
587
  value,
561
- onChange: (e) => setter(+e.target.value),
588
+ onChange: (e) => {
589
+ setter(+e.target.value);
590
+ setActivePreset(null);
591
+ },
562
592
  className: "w-full h-2 rounded-full appearance-none cursor-pointer accent-primary [&::-webkit-slider-runnable-track]:bg-border [&::-webkit-slider-runnable-track]:rounded-full [&::-webkit-slider-runnable-track]:h-2 [&::-moz-range-track]:bg-border [&::-moz-range-track]:rounded-full [&::-moz-range-track]:h-2 [&::-webkit-slider-thumb]:bg-primary [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:-mt-[6px] [&::-webkit-slider-thumb]:shadow-md [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-primary-foreground [&::-webkit-slider-thumb]:transition-transform [&::-webkit-slider-thumb]:hover:scale-110"
563
593
  }
564
594
  ),
@@ -829,7 +859,16 @@ function ProvisioningWizard({
829
859
  /* @__PURE__ */ jsx2("span", { children: "MEMORY" }),
830
860
  /* @__PURE__ */ jsxs2("span", { className: "text-foreground/80", children: [
831
861
  "$",
832
- (ramGB * 5e-3).toFixed(2)
862
+ (ramGB * 5e-3).toFixed(2),
863
+ "/h"
864
+ ] })
865
+ ] }),
866
+ /* @__PURE__ */ jsxs2("div", { className: "flex justify-between text-xs font-mono tracking-widest text-muted-foreground", children: [
867
+ /* @__PURE__ */ jsx2("span", { children: "STORAGE" }),
868
+ /* @__PURE__ */ jsxs2("span", { className: "text-foreground/80", children: [
869
+ "$",
870
+ (storageGB * 11e-4).toFixed(2),
871
+ "/h"
833
872
  ] })
834
873
  ] })
835
874
  ] })
@@ -902,16 +941,16 @@ async function fetchTiersFromApi(apiBasePath) {
902
941
  }
903
942
  var FAQ = [
904
943
  {
905
- q: "What are credits?",
906
- a: "Credits are used to pay for AI model usage. Different models consume different amounts of credits based on their complexity and the length of your requests."
944
+ q: "What is included usage?",
945
+ a: "Each plan includes a monthly USD usage balance. Compute and AI model usage are billed per second from this balance. If you exceed your included amount, overage is billed at the same rates with no penalty."
907
946
  },
908
947
  {
909
948
  q: "Can I change plans later?",
910
949
  a: "Yes. You can upgrade or downgrade your plan at any time. When you upgrade, you are charged the prorated difference. When you downgrade, the change takes effect at the end of your billing cycle."
911
950
  },
912
951
  {
913
- q: "Do unused credits roll over?",
914
- a: "Monthly credits do not roll over to the next month. However, purchased credit packs never expire and can be used at any time."
952
+ q: "Does unused balance roll over?",
953
+ a: "Monthly included usage does not roll over to the next month. Your balance resets at the start of each billing cycle."
915
954
  }
916
955
  ];
917
956
  function StandalonePricingPage({
package/dist/run.js CHANGED
@@ -8,14 +8,18 @@ import {
8
8
  InlineToolItem,
9
9
  LiveDuration,
10
10
  RunGroup
11
- } from "./chunk-EXSOPXIY.js";
11
+ } from "./chunk-QOL4ZB24.js";
12
12
  import "./chunk-HRMUF35V.js";
13
13
  import {
14
14
  ToolCallGroup,
15
15
  ToolCallStep
16
16
  } from "./chunk-MT5FJ3ZT.js";
17
17
  import "./chunk-BX6AQMUS.js";
18
+ import "./chunk-ZNCEM5CD.js";
19
+ import "./chunk-34I7UFSX.js";
18
20
  import "./chunk-T7HMZEVO.js";
21
+ import "./chunk-ZMNSRDMH.js";
22
+ import "./chunk-MKTSMWVD.js";
19
23
  import "./chunk-RQHJBTEU.js";
20
24
  export {
21
25
  ExpandedToolDetail,