@trops/dash-core 0.1.634 → 0.1.635

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.js CHANGED
@@ -47338,21 +47338,45 @@ var PROVIDER_LABELS = {
47338
47338
  xai: "xAI"
47339
47339
  };
47340
47340
  var AI_PROVIDER_TYPES = Object.keys(PROVIDER_LABELS);
47341
- function providerOptionsFrom(providers) {
47342
- var present = new Set();
47341
+ function presentProviderTypes(providers) {
47342
+ var present = [];
47343
47343
  for (var _i = 0, _Object$values = Object.values(providers || {}); _i < _Object$values.length; _i++) {
47344
47344
  var p = _Object$values[_i];
47345
- if (p && AI_PROVIDER_TYPES.includes(p.type)) present.add(p.type);
47345
+ if (p && AI_PROVIDER_TYPES.includes(p.type) && !present.includes(p.type)) {
47346
+ present.push(p.type);
47347
+ }
47346
47348
  }
47347
- return [{
47348
- value: "",
47349
- label: "Default provider"
47350
- }].concat(_toConsumableArray(_toConsumableArray(present).map(function (t) {
47349
+ return present;
47350
+ }
47351
+ function providerOptionsFrom(providers) {
47352
+ return [].concat(_toConsumableArray(presentProviderTypes(providers).map(function (t) {
47351
47353
  return {
47352
47354
  value: t,
47353
47355
  label: PROVIDER_LABELS[t] || t
47354
47356
  };
47355
- })));
47357
+ })), [
47358
+ // Auth via the logged-in Claude Code CLI — no API key needed. Runs on the
47359
+ // Claude Agent engine (native tools).
47360
+ {
47361
+ value: "claude-code",
47362
+ label: "Claude Code (CLI) — no API key"
47363
+ }]);
47364
+ }
47365
+
47366
+ /**
47367
+ * The provider to pre-select for a new bot: the user's configured default AI
47368
+ * (its `isDefaultForType`, else the first configured). If none is configured,
47369
+ * fall back to the always-available Claude Code (CLI) — it's the only option in
47370
+ * that case and needs no API key.
47371
+ */
47372
+ function defaultProviderId(providers) {
47373
+ var list = Object.values(providers || {}).filter(function (p) {
47374
+ return p && AI_PROVIDER_TYPES.includes(p.type);
47375
+ });
47376
+ var def = list.find(function (p) {
47377
+ return p.isDefaultForType;
47378
+ }) || list[0];
47379
+ return def ? def.type : "claude-code";
47356
47380
  }
47357
47381
  var APPROVAL_OPTIONS = [{
47358
47382
  value: "ask",
@@ -47411,7 +47435,7 @@ var BotDetail = function BotDetail(_ref) {
47411
47435
  _useState4 = _slicedToArray(_useState3, 2),
47412
47436
  instructions = _useState4[0],
47413
47437
  setInstructions = _useState4[1];
47414
- var _useState5 = React.useState((bot === null || bot === void 0 ? void 0 : bot.provider) || ""),
47438
+ var _useState5 = React.useState((bot === null || bot === void 0 ? void 0 : bot.provider) || defaultProviderId(providers)),
47415
47439
  _useState6 = _slicedToArray(_useState5, 2),
47416
47440
  provider = _useState6[0],
47417
47441
  setProvider = _useState6[1];
@@ -47680,12 +47704,17 @@ var BotDetail = function BotDetail(_ref) {
47680
47704
  placeholder: "What should this bot do?",
47681
47705
  rows: 5
47682
47706
  })]
47683
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
47684
- label: "Provider",
47685
- value: provider,
47686
- onChange: setProvider,
47687
- options: providerOptionsFrom(providers),
47688
- placeholder: "Default provider"
47707
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
47708
+ className: "flex flex-col gap-1",
47709
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
47710
+ label: "Provider",
47711
+ value: provider,
47712
+ onChange: setProvider,
47713
+ options: providerOptionsFrom(providers)
47714
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
47715
+ className: "text-xs opacity-50",
47716
+ children: "The AI that runs this bot. \"Claude Code (CLI)\" uses your Claude login \u2014 no API key needed."
47717
+ })]
47689
47718
  }), /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
47690
47719
  label: "Model",
47691
47720
  value: model,