deepcode-ai 1.2.17 → 1.2.18

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
@@ -11512,7 +11512,7 @@ function parseVersion(version) {
11512
11512
  if (!match) return null;
11513
11513
  return [Number(match[1]), Number(match[2]), Number(match[3])];
11514
11514
  }
11515
- var VERSION = "1.2.17".length > 0 ? "1.2.17" : "0.0.0-dev";
11515
+ var VERSION = "1.2.18".length > 0 ? "1.2.18" : "0.0.0-dev";
11516
11516
  async function updateCommand() {
11517
11517
  writeStdoutLine(`Current version: ${VERSION}`);
11518
11518
  const update = await checkForUpdate(VERSION, { force: true });
@@ -30621,6 +30621,19 @@ function providerGroup(model) {
30621
30621
  function isFree(model) {
30622
30622
  return model.pricing !== void 0 && model.pricing.inputPer1k === 0 && model.pricing.outputPer1k === 0;
30623
30623
  }
30624
+ function fmtCtx(n) {
30625
+ if (n >= 1e6) return `${(n / 1e6).toFixed(0)}M ctx`;
30626
+ if (n >= 1e3) return `${Math.round(n / 1e3)}k ctx`;
30627
+ return `${n} ctx`;
30628
+ }
30629
+ function fmtPrice(model) {
30630
+ if (!model.pricing) return null;
30631
+ if (isFree(model)) return "Free";
30632
+ const inp = model.pricing.inputPer1k;
30633
+ const out = model.pricing.outputPer1k;
30634
+ const fmtUsd = (n) => n < 0.01 ? `$${(n * 1e3).toFixed(2)}/M` : `$${n.toFixed(3)}/k`;
30635
+ return `${fmtUsd(inp)} in \xB7 ${fmtUsd(out)} out`;
30636
+ }
30624
30637
  function buildRows(models, currentId, search) {
30625
30638
  const q = search.toLowerCase();
30626
30639
  const filtered = search ? models.filter(
@@ -30794,22 +30807,35 @@ var ModelDialog = ({
30794
30807
  const { model, selIndex } = row;
30795
30808
  const isActive = selIndex === clampedIndex;
30796
30809
  const isCurrent = model.id === currentModel;
30797
- const free = isFree(model);
30810
+ const price = fmtPrice(model);
30798
30811
  const group = providerGroup(model);
30799
- return /* @__PURE__ */ jsxs52(Box48, { gap: 1, children: [
30800
- /* @__PURE__ */ jsx58(Text56, { color: isActive ? theme.text.accent : theme.ui.comment, children: isCurrent ? "\u25CF" : isActive ? "\u203A" : " " }),
30801
- /* @__PURE__ */ jsxs52(Box48, { flexGrow: 1, gap: 1, children: [
30802
- /* @__PURE__ */ jsx58(
30812
+ return /* @__PURE__ */ jsxs52(Box48, { flexDirection: "column", children: [
30813
+ /* @__PURE__ */ jsxs52(Box48, { gap: 1, children: [
30814
+ /* @__PURE__ */ jsx58(Text56, { color: isActive ? theme.text.accent : theme.ui.comment, children: isCurrent ? "\u25CF" : isActive ? "\u203A" : " " }),
30815
+ /* @__PURE__ */ jsxs52(Box48, { flexGrow: 1, gap: 1, children: [
30816
+ /* @__PURE__ */ jsx58(
30817
+ Text56,
30818
+ {
30819
+ color: isActive ? theme.text.primary : theme.text.secondary,
30820
+ bold: isActive,
30821
+ children: model.name
30822
+ }
30823
+ ),
30824
+ /* @__PURE__ */ jsx58(Text56, { color: theme.text.accent, dimColor: true, children: group })
30825
+ ] }),
30826
+ price && /* @__PURE__ */ jsx58(
30803
30827
  Text56,
30804
30828
  {
30805
- color: isActive ? theme.text.primary : theme.text.secondary,
30806
- bold: isActive,
30807
- children: model.name
30829
+ color: price === "Free" ? theme.status.success : theme.ui.comment,
30830
+ dimColor: !isActive,
30831
+ children: price
30808
30832
  }
30809
- ),
30810
- /* @__PURE__ */ jsx58(Text56, { color: theme.text.accent, dimColor: true, children: group })
30833
+ )
30811
30834
  ] }),
30812
- free && /* @__PURE__ */ jsx58(Text56, { color: theme.status.success, dimColor: !isActive, children: "Free" })
30835
+ isActive && /* @__PURE__ */ jsxs52(Box48, { paddingLeft: 2, gap: 2, children: [
30836
+ /* @__PURE__ */ jsx58(Text56, { color: theme.ui.comment, dimColor: true, children: model.id }),
30837
+ model.contextLength > 0 && /* @__PURE__ */ jsx58(Text56, { color: theme.ui.comment, dimColor: true, children: fmtCtx(model.contextLength) })
30838
+ ] })
30813
30839
  ] }, model.id);
30814
30840
  }),
30815
30841
  canScrollDown && /* @__PURE__ */ jsx58(Text56, { color: theme.ui.comment, dimColor: true, children: " \u2193" })
@@ -33154,12 +33180,34 @@ function buildDialogModel(dialog, options) {
33154
33180
  if (!dialog) return null;
33155
33181
  if (dialog === "help") {
33156
33182
  const maxNameLen = Math.max(...options.commands.map((c) => c.name.length + 1));
33183
+ const commandLines = options.commands.map((c) => {
33184
+ const label = `/${c.name}`.padEnd(maxNameLen + 1);
33185
+ return `${label} ${c.description}`;
33186
+ });
33187
+ const shortcuts = [
33188
+ ["Ctrl+C", "cancela execu\xE7\xE3o do agente (ou sai do campo de input)"],
33189
+ ["Ctrl+D", "encerra a sess\xE3o"],
33190
+ ["Ctrl+L", "limpa o hist\xF3rico vis\xEDvel na tela"],
33191
+ ["Ctrl+S", "expande mensagem longa (quando truncada)"],
33192
+ ["\u2191 / \u2193", "navega hist\xF3rico de prompts enviados"],
33193
+ ["Tab / \u2192", "aceita sugest\xE3o de follow-up"],
33194
+ ["Esc", "cancela aprova\xE7\xE3o pendente / fecha di\xE1logo"],
33195
+ ["y / \u21B5", "aprova ferramenta (uma vez)"],
33196
+ ["s", "aprova ferramenta para toda a sess\xE3o"],
33197
+ ["a", "aprova ferramenta permanentemente"],
33198
+ ["n", "nega aprova\xE7\xE3o de ferramenta"]
33199
+ ];
33200
+ const shortcutKeyLen = Math.max(...shortcuts.map(([k]) => k.length));
33201
+ const shortcutLines = shortcuts.map(([k, v]) => ` ${k.padEnd(shortcutKeyLen)} ${v}`);
33157
33202
  return {
33158
- title: "Comandos dispon\xEDveis",
33159
- lines: options.commands.map((c) => {
33160
- const label = `/${c.name}`.padEnd(maxNameLen + 1);
33161
- return `${label} ${c.description}`;
33162
- })
33203
+ title: "Ajuda \u2014 DeepCode",
33204
+ lines: [
33205
+ "\u2500\u2500 Slash commands \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",
33206
+ ...commandLines,
33207
+ "",
33208
+ "\u2500\u2500 Atalhos de teclado \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",
33209
+ ...shortcutLines
33210
+ ]
33163
33211
  };
33164
33212
  }
33165
33213
  if (dialog === "settings") {
@@ -33188,26 +33236,46 @@ function formatAuthSummary(config) {
33188
33236
  const enterprise = config.enterpriseUrl?.trim() ? `enterprise=${config.enterpriseUrl}` : "enterprise=github.com";
33189
33237
  return `github token=${tokenState}, ${oauthState}, ${enterprise}`;
33190
33238
  }
33239
+ var APPROVAL_PREVIEW_MAX_LINES = 6;
33191
33240
  var ApprovalPrompt = ({ request }) => {
33192
33241
  if (!request) return null;
33193
33242
  const operationLabel = formatApprovalOperationLabel(request);
33194
- return /* @__PURE__ */ jsxs56(Box52, { flexDirection: "column", marginTop: 1, children: [
33195
- /* @__PURE__ */ jsxs56(Text60, { color: theme.status.warning, children: [
33196
- "\u26A0 Allow ",
33197
- operationLabel,
33198
- "?"
33199
- ] }),
33200
- request.path && /* @__PURE__ */ jsxs56(Text60, { color: theme.text.secondary, children: [
33201
- " ",
33202
- request.path
33203
- ] }),
33204
- request.preview?.command && /* @__PURE__ */ jsxs56(Text60, { color: theme.text.secondary, children: [
33205
- " $ ",
33206
- request.preview.command,
33207
- request.preview.args?.length ? ` ${request.preview.args.join(" ")}` : ""
33208
- ] }),
33209
- /* @__PURE__ */ jsx62(Text60, { color: theme.text.secondary, children: " [\u21B5/y] once [s] session [a] always [n] deny" })
33210
- ] });
33243
+ let previewLines = [];
33244
+ if (request.diff?.after) {
33245
+ previewLines = request.diff.after.split("\n").slice(0, APPROVAL_PREVIEW_MAX_LINES);
33246
+ } else if (request.preview?.content) {
33247
+ previewLines = request.preview.content.split("\n").slice(0, APPROVAL_PREVIEW_MAX_LINES);
33248
+ }
33249
+ const previewTruncated = (request.diff?.after ?? request.preview?.content ?? "").split("\n").length > APPROVAL_PREVIEW_MAX_LINES;
33250
+ return /* @__PURE__ */ jsxs56(
33251
+ Box52,
33252
+ {
33253
+ flexDirection: "column",
33254
+ borderStyle: "round",
33255
+ borderColor: theme.status.warning,
33256
+ paddingX: 1,
33257
+ marginLeft: 2,
33258
+ marginRight: 2,
33259
+ marginTop: 1,
33260
+ children: [
33261
+ /* @__PURE__ */ jsxs56(Text60, { bold: true, color: theme.status.warning, children: [
33262
+ "\u26A0 ",
33263
+ operationLabel
33264
+ ] }),
33265
+ request.path && /* @__PURE__ */ jsx62(Text60, { color: theme.text.secondary, children: request.path }),
33266
+ request.preview?.command && /* @__PURE__ */ jsxs56(Text60, { color: theme.text.primary, children: [
33267
+ "$ ",
33268
+ request.preview.command,
33269
+ request.preview.args?.length ? ` ${request.preview.args.join(" ")}` : ""
33270
+ ] }),
33271
+ previewLines.length > 0 && /* @__PURE__ */ jsxs56(Box52, { flexDirection: "column", marginTop: 1, children: [
33272
+ previewLines.map((line, i) => /* @__PURE__ */ jsx62(Text60, { color: theme.ui.comment, dimColor: true, wrap: "truncate", children: line }, i)),
33273
+ previewTruncated && /* @__PURE__ */ jsx62(Text60, { color: theme.ui.comment, dimColor: true, children: "\u2026" })
33274
+ ] }),
33275
+ /* @__PURE__ */ jsx62(Box52, { marginTop: 1, children: /* @__PURE__ */ jsx62(Text60, { color: theme.text.secondary, dimColor: true, children: "[\u21B5/y] uma vez [s] sess\xE3o [a] sempre [n/Esc] negar" }) })
33276
+ ]
33277
+ }
33278
+ );
33211
33279
  };
33212
33280
  function formatApprovalOperationLabel(request) {
33213
33281
  const labels = {