@trydecember/cli 0.3.7 → 0.3.8

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 (2) hide show
  1. package/dist/december.js +116 -74
  2. package/package.json +1 -1
package/dist/december.js CHANGED
@@ -62566,15 +62566,17 @@ function safeParseJson(text) {
62566
62566
  if (cleanText.startsWith("{") && !cleanText.endsWith("}")) {
62567
62567
  try {
62568
62568
  return JSON.parse(cleanText + "}");
62569
- } catch (e) {}
62569
+ } catch {}
62570
62570
  }
62571
62571
  if (cleanText.endsWith(",}") || cleanText.endsWith(", }") || cleanText.match(/,\s*\}/)) {
62572
62572
  try {
62573
62573
  return JSON.parse(cleanText.replace(/,\s*\}/g, "}"));
62574
- } catch (e) {}
62574
+ } catch {}
62575
62575
  }
62576
62576
  throw new Error(`Failed to parse JSON tool arguments: ${err.message}
62577
- Raw text: ${text}`);
62577
+ Raw text: ${text}`, {
62578
+ cause: err
62579
+ });
62578
62580
  }
62579
62581
  }
62580
62582
 
@@ -104162,26 +104164,26 @@ var init_open = () => {};
104162
104164
 
104163
104165
  // src/auth/device.ts
104164
104166
  async function loginViaDeviceCode(baseUrl = process.env.SERVER_URL || process.env.WEB_URL || "https://api.trydecember.com", onCodeGenerated) {
104165
- return new Promise(async (resolve4, reject) => {
104167
+ try {
104168
+ const genRes = await fetch(`${baseUrl}/api/v1/auth/device/code`, {
104169
+ method: "POST",
104170
+ headers: { "Content-Type": "application/json" }
104171
+ });
104172
+ let genData = {};
104166
104173
  try {
104167
- const genRes = await fetch(`${baseUrl}/api/v1/auth/device/code`, {
104168
- method: "POST",
104169
- headers: { "Content-Type": "application/json" }
104170
- });
104171
- let genData = {};
104172
- try {
104173
- genData = await genRes.json();
104174
- } catch {}
104175
- if (!genRes.ok || !genData.success) {
104176
- throw new Error(genData.message || `Failed to generate device code (${genRes.status})`);
104177
- }
104178
- const { deviceCode, userCode, verificationUri, expiresIn, interval } = genData.data;
104179
- onCodeGenerated(userCode, verificationUri);
104180
- setTimeout(() => {
104181
- openUrl(verificationUri).catch(() => {});
104182
- }, 5000);
104183
- const startTime = Date.now();
104184
- const pollInterval = interval * 1000 || 5000;
104174
+ genData = await genRes.json();
104175
+ } catch {}
104176
+ if (!genRes.ok || !genData.success) {
104177
+ throw new Error(genData.message || `Failed to generate device code (${genRes.status})`);
104178
+ }
104179
+ const { deviceCode, userCode, verificationUri, expiresIn, interval } = genData.data;
104180
+ onCodeGenerated(userCode, verificationUri);
104181
+ setTimeout(() => {
104182
+ openUrl(verificationUri).catch(() => {});
104183
+ }, 5000);
104184
+ const startTime = Date.now();
104185
+ const pollInterval = interval * 1000 || 5000;
104186
+ return await new Promise((resolve4, reject) => {
104185
104187
  const poll = async () => {
104186
104188
  if (Date.now() - startTime > expiresIn * 1000) {
104187
104189
  reject(new Error("Device code expired"));
@@ -104211,15 +104213,17 @@ async function loginViaDeviceCode(baseUrl = process.env.SERVER_URL || process.en
104211
104213
  }
104212
104214
  };
104213
104215
  setTimeout(poll, pollInterval);
104214
- } catch (err) {
104215
- const msg = err?.message || String(err);
104216
- if (msg.includes("fetch failed") || msg.includes("ECONNREFUSED") || msg.includes("ENOTFOUND") || msg.includes("Failed to fetch") || msg.includes("connect")) {
104217
- reject(new Error("Unable to connect. Is the computer able to access the url?"));
104218
- } else {
104219
- reject(err);
104220
- }
104216
+ });
104217
+ } catch (err) {
104218
+ const msg = err?.message || String(err);
104219
+ if (msg.includes("fetch failed") || msg.includes("ECONNREFUSED") || msg.includes("ENOTFOUND") || msg.includes("Failed to fetch") || msg.includes("connect")) {
104220
+ throw new Error("Unable to connect. Is the computer able to access the url?", {
104221
+ cause: err
104222
+ });
104223
+ } else {
104224
+ throw err;
104221
104225
  }
104222
- });
104226
+ }
104223
104227
  }
104224
104228
  var init_device = __esm(() => {
104225
104229
  init_open();
@@ -205113,7 +205117,7 @@ function InputBar({
205113
205117
  onUpdateSuccess
205114
205118
  });
205115
205119
  }
205116
- }, [toast, dialog, agent2, resetChat, onUpdateSuccess, handleContentChange, onSubmit]);
205120
+ }, [toast, dialog, agent2, resetChat, onUpdateSuccess, handleContentChange, onSubmit, value2]);
205117
205121
  const handleSubmit = import_react41.useCallback((text3) => {
205118
205122
  if (disabled)
205119
205123
  return;
@@ -205134,6 +205138,7 @@ function InputBar({
205134
205138
  }, [
205135
205139
  disabled,
205136
205140
  showCommandMenu,
205141
+ showShortcutsMenu,
205137
205142
  resolveCommand,
205138
205143
  selectedIndex,
205139
205144
  handleCommand,
@@ -249474,7 +249479,7 @@ function parseFlowchart(code) {
249474
249479
  }
249475
249480
  continue;
249476
249481
  }
249477
- const edgeRegex = /^([A-Za-z0-9_]+)(?:\[(.*?)\]|\((.*?)\)|\{(.*?)\})?\s*(\-\-\>|\-\-\-|\=\=\>|\-\.\-\>)(?:\|(.*?)\|)?\s*([A-Za-z0-9_]+)(?:\[(.*?)\]|\((.*?)\)|\{(.*?)\})?/;
249482
+ const edgeRegex = /^([A-Za-z0-9_]+)(?:\[(.*?)\]|\((.*?)\)|\{(.*?)\})?\s*(-->|---|==>|-\.->)(?:\|(.*?)\|)?\s*([A-Za-z0-9_]+)(?:\[(.*?)\]|\((.*?)\)|\{(.*?)\})?/;
249478
249483
  const match2 = line.match(edgeRegex);
249479
249484
  if (match2) {
249480
249485
  const fromId = match2[1];
@@ -249534,7 +249539,7 @@ function parseSequence(code) {
249534
249539
  participantsSet.add(name);
249535
249540
  continue;
249536
249541
  }
249537
- const msgMatch = line.match(/^([A-Za-z0-9_]+)\s*(\-\>\>|\-\-\>\>|\-\>)\s*([A-Za-z0-9_]+)\s*:\s*(.*)$/);
249542
+ const msgMatch = line.match(/^([A-Za-z0-9_]+)\s*(->>|-->>|->)\s*([A-Za-z0-9_]+)\s*:\s*(.*)$/);
249538
249543
  if (msgMatch) {
249539
249544
  const from = msgMatch[1];
249540
249545
  const arrow = msgMatch[2];
@@ -249593,7 +249598,7 @@ function Mermaid({ code }) {
249593
249598
  paddingX: 2,
249594
249599
  paddingY: 1,
249595
249600
  borderStyle: "round",
249596
- borderColor: "#A78BFA",
249601
+ borderColor: "#555555",
249597
249602
  children: [
249598
249603
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
249599
249604
  justifyContent: "space-between",
@@ -249601,8 +249606,7 @@ function Mermaid({ code }) {
249601
249606
  marginBottom: 1,
249602
249607
  children: [
249603
249608
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text3, {
249604
- color: "#A78BFA",
249605
- bold: true,
249609
+ color: "white",
249606
249610
  children: [
249607
249611
  "❖ Mermaid Diagram (",
249608
249612
  isSequence ? "sequence" : isPie ? "pie" : isFlowchart ? "flowchart" : "diagram",
@@ -249660,10 +249664,9 @@ function RenderFlowchart({ code }) {
249660
249664
  children: [
249661
249665
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
249662
249666
  borderStyle: "round",
249663
- borderColor: "#89B4F8",
249667
+ borderColor: "gray",
249664
249668
  paddingX: 1,
249665
249669
  children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text3, {
249666
- bold: true,
249667
249670
  color: "white",
249668
249671
  children: node2.label
249669
249672
  }, undefined, false, undefined, this)
@@ -249673,7 +249676,7 @@ function RenderFlowchart({ code }) {
249673
249676
  alignItems: "center",
249674
249677
  children: [
249675
249678
  outgoingEdges[0].label && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text3, {
249676
- color: "#A78BFA",
249679
+ color: "gray",
249677
249680
  italic: true,
249678
249681
  children: [
249679
249682
  "[",
@@ -249682,7 +249685,7 @@ function RenderFlowchart({ code }) {
249682
249685
  ]
249683
249686
  }, undefined, true, undefined, this),
249684
249687
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text3, {
249685
- color: "#89B4F8",
249688
+ color: "gray",
249686
249689
  children: outgoingEdges[0].style === "dashed" ? " ┈► " : outgoingEdges[0].style === "thick" ? " ══► " : " ──► "
249687
249690
  }, undefined, false, undefined, this)
249688
249691
  ]
@@ -249701,10 +249704,9 @@ function RenderFlowchart({ code }) {
249701
249704
  children: [
249702
249705
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
249703
249706
  borderStyle: "round",
249704
- borderColor: "#89B4F8",
249707
+ borderColor: "gray",
249705
249708
  paddingX: 1,
249706
249709
  children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text3, {
249707
- bold: true,
249708
249710
  color: "white",
249709
249711
  children: node2.label
249710
249712
  }, undefined, false, undefined, this)
@@ -249714,7 +249716,7 @@ function RenderFlowchart({ code }) {
249714
249716
  paddingLeft: 3,
249715
249717
  children: [
249716
249718
  outgoingEdges[0].label && /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text3, {
249717
- color: "#A78BFA",
249719
+ color: "gray",
249718
249720
  italic: true,
249719
249721
  children: [
249720
249722
  "[",
@@ -249723,7 +249725,7 @@ function RenderFlowchart({ code }) {
249723
249725
  ]
249724
249726
  }, undefined, true, undefined, this),
249725
249727
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text3, {
249726
- color: "#89B4F8",
249728
+ color: "gray",
249727
249729
  children: outgoingEdges[0].style === "dashed" ? ` ┆
249728
249730
  ▼ ` : ` │
249729
249731
  ▼ `
@@ -249741,7 +249743,6 @@ function RenderFlowchart({ code }) {
249741
249743
  children: [
249742
249744
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text3, {
249743
249745
  color: "gray",
249744
- bold: true,
249745
249746
  children: "Connections:"
249746
249747
  }, undefined, false, undefined, this),
249747
249748
  edges.map((edge, idx) => {
@@ -249754,7 +249755,7 @@ function RenderFlowchart({ code }) {
249754
249755
  fromNode,
249755
249756
  " ",
249756
249757
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text3, {
249757
- color: "#89B4F8",
249758
+ color: "gray",
249758
249759
  children: edge.style === "dashed" ? "┈►" : "──►"
249759
249760
  }, undefined, false, undefined, this),
249760
249761
  " ",
@@ -249785,10 +249786,9 @@ function RenderSequence({ code }) {
249785
249786
  gap: 2,
249786
249787
  children: participants.map((p) => /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
249787
249788
  borderStyle: "single",
249788
- borderColor: "#89B4F8",
249789
+ borderColor: "gray",
249789
249790
  paddingX: 1,
249790
249791
  children: /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text3, {
249791
- bold: true,
249792
249792
  color: "white",
249793
249793
  children: p
249794
249794
  }, undefined, false, undefined, this)
@@ -249802,19 +249802,17 @@ function RenderSequence({ code }) {
249802
249802
  color: "#DDDDDD",
249803
249803
  children: [
249804
249804
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text3, {
249805
- color: "#89B4F8",
249806
- bold: true,
249805
+ color: "white",
249807
249806
  children: msg.from
249808
249807
  }, undefined, false, undefined, this),
249809
249808
  " ",
249810
249809
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text3, {
249811
- color: msg.style === "dashed" ? "#A78BFA" : "#89B4F8",
249810
+ color: "gray",
249812
249811
  children: msg.style === "dashed" ? "◄┄┄" : "──►"
249813
249812
  }, undefined, false, undefined, this),
249814
249813
  " ",
249815
249814
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text3, {
249816
- color: "#89B4F8",
249817
- bold: true,
249815
+ color: "white",
249818
249816
  children: msg.to
249819
249817
  }, undefined, false, undefined, this),
249820
249818
  ": ",
@@ -249842,7 +249840,6 @@ function RenderPie({ code }) {
249842
249840
  gap: 1,
249843
249841
  children: [
249844
249842
  /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Text3, {
249845
- bold: true,
249846
249843
  color: "white",
249847
249844
  children: title
249848
249845
  }, undefined, false, undefined, this),
@@ -249851,7 +249848,7 @@ function RenderPie({ code }) {
249851
249848
  const filledWidth = Math.round(percentage / 100 * 20);
249852
249849
  const emptyWidth = 20 - filledWidth;
249853
249850
  const bar = "█".repeat(filledWidth) + "░".repeat(emptyWidth);
249854
- const color = idx % 2 === 0 ? "#89B4F8" : "#A78BFA";
249851
+ const color = idx % 2 === 0 ? "white" : "gray";
249855
249852
  return /* @__PURE__ */ jsx_dev_runtime9.jsxDEV(Box_default, {
249856
249853
  flexDirection: "row",
249857
249854
  gap: 2,
@@ -253259,7 +253256,7 @@ function TaskHUD({ cwd: cwd2, showTasks = true }) {
253259
253256
  width: 40,
253260
253257
  children: [
253261
253258
  /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(Text3, {
253262
- color: "#A78BFA",
253259
+ color: "#89B4F8",
253263
253260
  bold: true,
253264
253261
  children: "Active Plan (task.md)"
253265
253262
  }, undefined, false, undefined, this),
@@ -253438,7 +253435,8 @@ function ChatApp({
253438
253435
  setStaticMessages,
253439
253436
  setStaticKey,
253440
253437
  setActiveMessages,
253441
- setAuthMode
253438
+ setAuthMode,
253439
+ handleSubmit
253442
253440
  } = session;
253443
253441
  const authUI = authMode !== "none" ? authMode === "ask_question" && session.pendingQuestions ? /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(AskQuestionMenu, {
253444
253442
  questions: session.pendingQuestions.questions,
@@ -253453,8 +253451,8 @@ function ChatApp({
253453
253451
  getProviderModels: session.getProviderModels
253454
253452
  }, undefined, false, undefined, this) : null;
253455
253453
  const handleFormSubmit = import_react53.useCallback((text3) => {
253456
- session.handleSubmit(text3);
253457
- }, [session.handleSubmit]);
253454
+ handleSubmit(text3);
253455
+ }, [handleSubmit]);
253458
253456
  const totalTokens = [...staticMessages, ...activeMessages].reduce((acc, msg) => {
253459
253457
  if (msg.usage) {
253460
253458
  return acc + (msg.usage.promptTokens || 0) + (msg.usage.completionTokens || 0);
@@ -254083,7 +254081,7 @@ __export(exports_error_parser, {
254083
254081
  });
254084
254082
  import util5 from "util";
254085
254083
  function parseErrorMessage(err) {
254086
- let errMsg = "";
254084
+ let errMsg;
254087
254085
  try {
254088
254086
  errMsg = err?.message || String(err);
254089
254087
  if (typeof errMsg !== "string") {
@@ -255322,7 +255320,7 @@ function useAgentSession({
255322
255320
  return { block: false };
255323
255321
  };
255324
255322
  }
255325
- }, [agent2]);
255323
+ }, [agent2, setAuthMode, setPendingQuestions]);
255326
255324
  import_react55.useEffect(() => {
255327
255325
  if (authMode === "tasks_mode") {
255328
255326
  const update3 = () => {
@@ -255378,7 +255376,19 @@ function useAgentSession({
255378
255376
  } finally {
255379
255377
  setIsStreaming(false);
255380
255378
  }
255381
- }, [agent2]);
255379
+ }, [
255380
+ agent2,
255381
+ addToast,
255382
+ setActiveMessages,
255383
+ setAuthMode,
255384
+ setCurrentGrillIndex,
255385
+ setCustomInputMode,
255386
+ setGrillAnswers,
255387
+ setGrillPrompt,
255388
+ setGrillQuestions,
255389
+ setIsStreaming,
255390
+ setStaticMessages
255391
+ ]);
255382
255392
  const generatePlanFromGrill = import_react55.useCallback(async (answers) => {
255383
255393
  setAuthMode("none");
255384
255394
  const originalPrompt = grillPrompt;
@@ -255412,7 +255422,19 @@ function useAgentSession({
255412
255422
  setIsStreaming(false);
255413
255423
  setAuthMode("plan_approve");
255414
255424
  }
255415
- }, [agent2, grillPrompt, grillQuestions, activeMessages]);
255425
+ }, [
255426
+ agent2,
255427
+ grillPrompt,
255428
+ grillQuestions,
255429
+ setActiveMessages,
255430
+ setAuthMode,
255431
+ setCurrentPlannedPrompt,
255432
+ setGrillAnswers,
255433
+ setGrillPrompt,
255434
+ setGrillQuestions,
255435
+ setIsStreaming,
255436
+ setStaticMessages
255437
+ ]);
255416
255438
  const handleGrillSelect = import_react55.useCallback(async (item) => {
255417
255439
  if (item.value === "custom") {
255418
255440
  setCustomInputMode(true);
@@ -255425,7 +255447,15 @@ function useAgentSession({
255425
255447
  } else {
255426
255448
  await generatePlanFromGrill(nextAnswers);
255427
255449
  }
255428
- }, [grillAnswers, currentGrillIndex, grillQuestions, generatePlanFromGrill]);
255450
+ }, [
255451
+ grillAnswers,
255452
+ currentGrillIndex,
255453
+ grillQuestions,
255454
+ generatePlanFromGrill,
255455
+ setCurrentGrillIndex,
255456
+ setCustomInputMode,
255457
+ setGrillAnswers
255458
+ ]);
255429
255459
  const handleSubmit = import_react55.useCallback(async (text3) => {
255430
255460
  if (text3.trim() === "/exit") {
255431
255461
  setShouldExit(true);
@@ -255684,19 +255714,31 @@ Please run \`/login\` to:
255684
255714
  }
255685
255715
  }, [
255686
255716
  agent2,
255687
- activeMessages,
255688
255717
  isAuthenticated,
255689
255718
  isStreaming,
255690
- grillQuestions,
255691
- grillAnswers,
255692
- customInputMode,
255693
- generatePlanFromGrill,
255694
255719
  generateGrillQuestions,
255695
255720
  sessionRepository,
255696
- authMode,
255697
- currentGrillIndex,
255698
255721
  grillMode,
255699
- setQueuedPrompts
255722
+ setQueuedPrompts,
255723
+ addToast,
255724
+ setActiveMessages,
255725
+ setAuthMode,
255726
+ setGrillMode,
255727
+ setIsStreaming,
255728
+ setLogoutItems,
255729
+ setSelectedProvider,
255730
+ setSessionPage,
255731
+ setSessionRenameMode,
255732
+ setSessionSelectedIndex,
255733
+ setSessionsData,
255734
+ setSettingsFollowUpMode,
255735
+ setSettingsNonWorkspace,
255736
+ setSettingsShowTasks,
255737
+ setSettingsSteeringMode,
255738
+ setSettingsThinkingLevel,
255739
+ setSettingsToolPermission,
255740
+ setShouldExit,
255741
+ setStaticMessages
255700
255742
  ]);
255701
255743
  const handleAbort = import_react55.useCallback(() => {
255702
255744
  if (isStreaming && agent2) {
@@ -255729,7 +255771,7 @@ Please run \`/login\` to:
255729
255771
  } else {
255730
255772
  addToast("Plan rejected.", "error");
255731
255773
  }
255732
- }, [currentPlannedPrompt, handleSubmit, addToast, setAuthMode]);
255774
+ }, [currentPlannedPrompt, handleSubmit, addToast, setAuthMode, setCurrentPlannedPrompt]);
255733
255775
  const handleContextSelect = () => {};
255734
255776
  return {
255735
255777
  currentPlannedPrompt,
@@ -261612,7 +261654,7 @@ var init_version_check = __esm(() => {
261612
261654
  // package.json
261613
261655
  var package_default = {
261614
261656
  name: "@trydecember/cli",
261615
- version: "0.3.7",
261657
+ version: "0.3.8",
261616
261658
  description: "AI coding agent that runs in your terminal and the cloud.",
261617
261659
  homepage: "https://trydecember.com",
261618
261660
  repository: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trydecember/cli",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "AI coding agent that runs in your terminal and the cloud.",
5
5
  "homepage": "https://trydecember.com",
6
6
  "repository": {