@trydecember/cli 0.3.13 → 0.3.14
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/december.js +940 -745
- package/package.json +1 -1
package/dist/december.js
CHANGED
|
@@ -213744,7 +213744,6 @@ var init_handoff = __esm(() => {
|
|
|
213744
213744
|
});
|
|
213745
213745
|
|
|
213746
213746
|
// ../../packages/tui/src/components/command-menu/commands.tsx
|
|
213747
|
-
import { exec as exec5 } from "node:child_process";
|
|
213748
213747
|
import fs17 from "node:fs";
|
|
213749
213748
|
import os9 from "node:os";
|
|
213750
213749
|
import path16 from "node:path";
|
|
@@ -214048,28 +214047,7 @@ build/
|
|
|
214048
214047
|
name: "update",
|
|
214049
214048
|
description: "Update to the latest version",
|
|
214050
214049
|
value: "/update",
|
|
214051
|
-
action: (ctx) => {
|
|
214052
|
-
ctx.toast.show({ message: "Updating CLI..." });
|
|
214053
|
-
exec5("npm install -g @trydecember/cli", async (err) => {
|
|
214054
|
-
if (err) {
|
|
214055
|
-
ctx.toast.show({
|
|
214056
|
-
variant: "error",
|
|
214057
|
-
message: "Update failed. Check your npm logs."
|
|
214058
|
-
});
|
|
214059
|
-
return;
|
|
214060
|
-
}
|
|
214061
|
-
if (ctx.agent) {
|
|
214062
|
-
await ctx.agent.saveContext();
|
|
214063
|
-
}
|
|
214064
|
-
if (ctx.onUpdateSuccess) {
|
|
214065
|
-
await ctx.onUpdateSuccess();
|
|
214066
|
-
}
|
|
214067
|
-
ctx.toast.show({
|
|
214068
|
-
variant: "success",
|
|
214069
|
-
message: "December CLI updated successfully! Please restart the CLI in your terminal."
|
|
214070
|
-
});
|
|
214071
|
-
});
|
|
214072
|
-
}
|
|
214050
|
+
action: (ctx) => {}
|
|
214073
214051
|
},
|
|
214074
214052
|
{
|
|
214075
214053
|
name: "usage",
|
|
@@ -214711,400 +214689,414 @@ var init_text_area = __esm(async () => {
|
|
|
214711
214689
|
});
|
|
214712
214690
|
|
|
214713
214691
|
// ../../packages/tui/src/components/input-bar.tsx
|
|
214714
|
-
|
|
214715
|
-
|
|
214716
|
-
|
|
214717
|
-
|
|
214718
|
-
|
|
214719
|
-
|
|
214720
|
-
|
|
214721
|
-
|
|
214722
|
-
|
|
214723
|
-
|
|
214724
|
-
|
|
214725
|
-
|
|
214726
|
-
|
|
214727
|
-
|
|
214728
|
-
|
|
214729
|
-
|
|
214730
|
-
|
|
214731
|
-
|
|
214732
|
-
|
|
214733
|
-
|
|
214734
|
-
|
|
214735
|
-
|
|
214736
|
-
|
|
214737
|
-
|
|
214738
|
-
|
|
214739
|
-
|
|
214740
|
-
|
|
214741
|
-
|
|
214742
|
-
|
|
214743
|
-
|
|
214744
|
-
|
|
214745
|
-
|
|
214746
|
-
|
|
214747
|
-
|
|
214748
|
-
|
|
214749
|
-
|
|
214750
|
-
|
|
214751
|
-
|
|
214752
|
-
|
|
214753
|
-
|
|
214754
|
-
|
|
214755
|
-
|
|
214756
|
-
|
|
214757
|
-
|
|
214758
|
-
|
|
214759
|
-
|
|
214760
|
-
|
|
214761
|
-
|
|
214762
|
-
|
|
214763
|
-
|
|
214764
|
-
|
|
214765
|
-
|
|
214766
|
-
|
|
214767
|
-
|
|
214768
|
-
|
|
214769
|
-
|
|
214770
|
-
|
|
214771
|
-
|
|
214772
|
-
|
|
214773
|
-
|
|
214774
|
-
|
|
214775
|
-
|
|
214776
|
-
|
|
214777
|
-
|
|
214778
|
-
|
|
214779
|
-
|
|
214780
|
-
use_input_default((input, key) => {
|
|
214781
|
-
if (showFileMenu && matchingFiles.length > 0) {
|
|
214782
|
-
if (key.upArrow) {
|
|
214783
|
-
setSelectedFileIndex((prev2) => Math.max(0, prev2 - 1));
|
|
214784
|
-
return;
|
|
214785
|
-
}
|
|
214786
|
-
if (key.downArrow) {
|
|
214787
|
-
setSelectedFileIndex((prev2) => Math.min(matchingFiles.length - 1, prev2 + 1));
|
|
214692
|
+
var import_fast_glob, import_react42, jsx_runtime8, MAX_FILE_SUGGESTIONS = 5, InputBar;
|
|
214693
|
+
var init_input_bar = __esm(async () => {
|
|
214694
|
+
init_src();
|
|
214695
|
+
init_theme();
|
|
214696
|
+
init_prompt_history();
|
|
214697
|
+
await __promiseAll([
|
|
214698
|
+
init_build2(),
|
|
214699
|
+
init_use_terminal_columns(),
|
|
214700
|
+
init_dialog(),
|
|
214701
|
+
init_toast(),
|
|
214702
|
+
init_command_menu(),
|
|
214703
|
+
init_use_command_menu(),
|
|
214704
|
+
init_shortcuts_menu(),
|
|
214705
|
+
init_text_area()
|
|
214706
|
+
]);
|
|
214707
|
+
import_fast_glob = __toESM(require_out4(), 1);
|
|
214708
|
+
import_react42 = __toESM(require_react(), 1);
|
|
214709
|
+
jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
|
|
214710
|
+
InputBar = import_react42.default.memo(function InputBar2({
|
|
214711
|
+
onSubmit,
|
|
214712
|
+
disabled = false,
|
|
214713
|
+
placeholder = "Ask December to build...",
|
|
214714
|
+
activeModel = "unknown",
|
|
214715
|
+
authMethod,
|
|
214716
|
+
hasBothAuth = false,
|
|
214717
|
+
authUI,
|
|
214718
|
+
agent: agent2,
|
|
214719
|
+
resetChat,
|
|
214720
|
+
onUpdateSuccess,
|
|
214721
|
+
grillMode = false,
|
|
214722
|
+
customInputMode = false,
|
|
214723
|
+
onInterrupt,
|
|
214724
|
+
onCopy,
|
|
214725
|
+
contextTokens,
|
|
214726
|
+
showExitConfirm = false,
|
|
214727
|
+
toasts,
|
|
214728
|
+
queuedPrompts
|
|
214729
|
+
}) {
|
|
214730
|
+
const [value2, setValue] = import_react42.useState("");
|
|
214731
|
+
const toast = useToast();
|
|
214732
|
+
const dialog = useDialog();
|
|
214733
|
+
const columns = useTerminalColumns();
|
|
214734
|
+
const [selectedFileIndex, setSelectedFileIndex] = import_react42.useState(0);
|
|
214735
|
+
const [allWorkspaceFiles, setAllWorkspaceFiles] = import_react42.useState([]);
|
|
214736
|
+
const activeToast = toasts && toasts.length > 0 ? toasts[toasts.length - 1] : toast.currentToast ? { message: toast.currentToast.message, variant: toast.currentToast.variant } : null;
|
|
214737
|
+
const handleContentChangeRef = import_react42.useRef(() => {});
|
|
214738
|
+
const handleAutocompleteCommand = import_react42.useCallback((completedText) => {
|
|
214739
|
+
setValue(completedText);
|
|
214740
|
+
handleContentChangeRef.current(completedText);
|
|
214741
|
+
}, []);
|
|
214742
|
+
const {
|
|
214743
|
+
showCommandMenu,
|
|
214744
|
+
commandQuery,
|
|
214745
|
+
selectedIndex,
|
|
214746
|
+
windowStart,
|
|
214747
|
+
handleContentChange,
|
|
214748
|
+
resolveCommand,
|
|
214749
|
+
setSelectedIndex
|
|
214750
|
+
} = useCommandMenu({ onAutocomplete: handleAutocompleteCommand });
|
|
214751
|
+
handleContentChangeRef.current = handleContentChange;
|
|
214752
|
+
const [showShortcutsMenu, setShowShortcutsMenu] = import_react42.useState(false);
|
|
214753
|
+
const fileMatch = value2.match(/@(\S*)$/);
|
|
214754
|
+
const showFileMenu = Boolean(fileMatch) && !showCommandMenu && !showShortcutsMenu;
|
|
214755
|
+
const fileQuery = fileMatch ? fileMatch[1]?.toLowerCase() || "" : "";
|
|
214756
|
+
import_react42.useEffect(() => {
|
|
214757
|
+
if (!fileMatch || allWorkspaceFiles.length > 0)
|
|
214788
214758
|
return;
|
|
214759
|
+
let isMounted = true;
|
|
214760
|
+
try {
|
|
214761
|
+
const ignores = getWorkspaceIgnores();
|
|
214762
|
+
import_fast_glob.default(["**/*"], {
|
|
214763
|
+
dot: true,
|
|
214764
|
+
ignore: ignores,
|
|
214765
|
+
onlyFiles: true,
|
|
214766
|
+
suppressErrors: true
|
|
214767
|
+
}).then((files) => {
|
|
214768
|
+
if (isMounted) {
|
|
214769
|
+
setAllWorkspaceFiles(files);
|
|
214770
|
+
}
|
|
214771
|
+
}).catch(() => {
|
|
214772
|
+
if (isMounted) {
|
|
214773
|
+
setAllWorkspaceFiles([]);
|
|
214774
|
+
}
|
|
214775
|
+
});
|
|
214776
|
+
} catch {
|
|
214777
|
+
setAllWorkspaceFiles([]);
|
|
214789
214778
|
}
|
|
214790
|
-
|
|
214791
|
-
|
|
214792
|
-
|
|
214793
|
-
|
|
214779
|
+
return () => {
|
|
214780
|
+
isMounted = false;
|
|
214781
|
+
};
|
|
214782
|
+
}, [fileMatch, allWorkspaceFiles.length]);
|
|
214783
|
+
const matchingFiles = import_react42.useMemo(() => {
|
|
214784
|
+
if (!showFileMenu)
|
|
214785
|
+
return [];
|
|
214786
|
+
return allWorkspaceFiles.filter((f3) => f3.toLowerCase().includes(fileQuery)).slice(0, MAX_FILE_SUGGESTIONS);
|
|
214787
|
+
}, [showFileMenu, allWorkspaceFiles, fileQuery]);
|
|
214788
|
+
const isCtrlW = import_react42.useRef(false);
|
|
214789
|
+
use_input_default((input, key) => {
|
|
214790
|
+
if (showFileMenu && matchingFiles.length > 0) {
|
|
214791
|
+
if (key.upArrow) {
|
|
214792
|
+
setSelectedFileIndex((prev2) => Math.max(0, prev2 - 1));
|
|
214793
|
+
return;
|
|
214794
|
+
}
|
|
214795
|
+
if (key.downArrow) {
|
|
214796
|
+
setSelectedFileIndex((prev2) => Math.min(matchingFiles.length - 1, prev2 + 1));
|
|
214797
|
+
return;
|
|
214798
|
+
}
|
|
214799
|
+
if (key.tab || key.return) {
|
|
214800
|
+
const selectedFile = matchingFiles[selectedFileIndex];
|
|
214801
|
+
if (selectedFile) {
|
|
214802
|
+
const nextVal = value2.replace(/@\S*$/, `@${selectedFile} `);
|
|
214803
|
+
setValue(nextVal);
|
|
214804
|
+
handleContentChange(nextVal);
|
|
214805
|
+
setSelectedFileIndex(0);
|
|
214806
|
+
}
|
|
214807
|
+
return;
|
|
214808
|
+
}
|
|
214809
|
+
if (key.escape) {
|
|
214810
|
+
const nextVal = value2.replace(/@\S*$/, "");
|
|
214794
214811
|
setValue(nextVal);
|
|
214795
214812
|
handleContentChange(nextVal);
|
|
214796
|
-
|
|
214813
|
+
return;
|
|
214797
214814
|
}
|
|
214815
|
+
}
|
|
214816
|
+
if (key.ctrl && input === "w") {
|
|
214817
|
+
isCtrlW.current = true;
|
|
214818
|
+
setValue((prev2) => {
|
|
214819
|
+
const match2 = prev2.match(/(\s*\S+\s*)$/);
|
|
214820
|
+
const next2 = match2 ? prev2.slice(0, -match2[0].length) : prev2;
|
|
214821
|
+
handleContentChange(next2);
|
|
214822
|
+
return next2;
|
|
214823
|
+
});
|
|
214824
|
+
}
|
|
214825
|
+
if ((key.backspace || key.delete) && value2.length === 0 && grillMode) {
|
|
214826
|
+
onSubmit("/grill-me");
|
|
214827
|
+
}
|
|
214828
|
+
if (key.ctrl && input === "c") {
|
|
214829
|
+
if (onInterrupt)
|
|
214830
|
+
onInterrupt();
|
|
214798
214831
|
return;
|
|
214799
214832
|
}
|
|
214800
|
-
if (key.
|
|
214801
|
-
|
|
214802
|
-
|
|
214803
|
-
handleContentChange(nextVal);
|
|
214833
|
+
if (key.ctrl && input === "y") {
|
|
214834
|
+
if (onCopy)
|
|
214835
|
+
onCopy();
|
|
214804
214836
|
return;
|
|
214805
214837
|
}
|
|
214806
|
-
}
|
|
214807
|
-
|
|
214808
|
-
|
|
214809
|
-
|
|
214810
|
-
|
|
214811
|
-
|
|
214838
|
+
});
|
|
214839
|
+
const handleChange = import_react42.useCallback((newValue) => {
|
|
214840
|
+
if (disabled)
|
|
214841
|
+
return;
|
|
214842
|
+
if (isCtrlW.current) {
|
|
214843
|
+
isCtrlW.current = false;
|
|
214844
|
+
return;
|
|
214845
|
+
}
|
|
214846
|
+
if (newValue === "?") {
|
|
214847
|
+
setShowShortcutsMenu(true);
|
|
214848
|
+
setValue("?");
|
|
214849
|
+
return;
|
|
214850
|
+
} else if (showShortcutsMenu) {
|
|
214851
|
+
setShowShortcutsMenu(false);
|
|
214852
|
+
}
|
|
214853
|
+
setValue(newValue);
|
|
214854
|
+
handleContentChange(newValue);
|
|
214855
|
+
setSelectedFileIndex(0);
|
|
214856
|
+
}, [disabled, handleContentChange, showShortcutsMenu]);
|
|
214857
|
+
const handleHistoryUp = import_react42.useCallback(() => {
|
|
214858
|
+
const prev2 = defaultPromptHistory.getPrevious(value2);
|
|
214859
|
+
if (prev2 !== value2) {
|
|
214860
|
+
setValue(prev2);
|
|
214861
|
+
handleContentChange(prev2);
|
|
214862
|
+
}
|
|
214863
|
+
}, [value2, handleContentChange]);
|
|
214864
|
+
const handleHistoryDown = import_react42.useCallback(() => {
|
|
214865
|
+
const next2 = defaultPromptHistory.getNext();
|
|
214866
|
+
if (next2 !== value2) {
|
|
214867
|
+
setValue(next2);
|
|
214812
214868
|
handleContentChange(next2);
|
|
214813
|
-
return next2;
|
|
214814
|
-
});
|
|
214815
|
-
}
|
|
214816
|
-
if ((key.backspace || key.delete) && value2.length === 0 && grillMode) {
|
|
214817
|
-
onSubmit("/grill-me");
|
|
214818
|
-
}
|
|
214819
|
-
if (key.ctrl && input === "c") {
|
|
214820
|
-
if (onInterrupt)
|
|
214821
|
-
onInterrupt();
|
|
214822
|
-
return;
|
|
214823
|
-
}
|
|
214824
|
-
if (key.ctrl && input === "y") {
|
|
214825
|
-
if (onCopy)
|
|
214826
|
-
onCopy();
|
|
214827
|
-
return;
|
|
214828
|
-
}
|
|
214829
|
-
});
|
|
214830
|
-
const handleChange = import_react42.useCallback((newValue) => {
|
|
214831
|
-
if (disabled)
|
|
214832
|
-
return;
|
|
214833
|
-
if (isCtrlW.current) {
|
|
214834
|
-
isCtrlW.current = false;
|
|
214835
|
-
return;
|
|
214836
|
-
}
|
|
214837
|
-
if (newValue === "?") {
|
|
214838
|
-
setShowShortcutsMenu(true);
|
|
214839
|
-
setValue("?");
|
|
214840
|
-
return;
|
|
214841
|
-
} else if (showShortcutsMenu) {
|
|
214842
|
-
setShowShortcutsMenu(false);
|
|
214843
|
-
}
|
|
214844
|
-
setValue(newValue);
|
|
214845
|
-
handleContentChange(newValue);
|
|
214846
|
-
setSelectedFileIndex(0);
|
|
214847
|
-
}, [disabled, handleContentChange, showShortcutsMenu]);
|
|
214848
|
-
const handleHistoryUp = import_react42.useCallback(() => {
|
|
214849
|
-
const prev2 = defaultPromptHistory.getPrevious(value2);
|
|
214850
|
-
if (prev2 !== value2) {
|
|
214851
|
-
setValue(prev2);
|
|
214852
|
-
handleContentChange(prev2);
|
|
214853
|
-
}
|
|
214854
|
-
}, [value2, handleContentChange]);
|
|
214855
|
-
const handleHistoryDown = import_react42.useCallback(() => {
|
|
214856
|
-
const next2 = defaultPromptHistory.getNext();
|
|
214857
|
-
if (next2 !== value2) {
|
|
214858
|
-
setValue(next2);
|
|
214859
|
-
handleContentChange(next2);
|
|
214860
|
-
}
|
|
214861
|
-
}, [value2, handleContentChange]);
|
|
214862
|
-
const handleCommand = import_react42.useCallback((command) => {
|
|
214863
|
-
if (!command)
|
|
214864
|
-
return;
|
|
214865
|
-
const currentValue = value2.trim();
|
|
214866
|
-
setValue("");
|
|
214867
|
-
handleContentChange("");
|
|
214868
|
-
const forwardCommands = [
|
|
214869
|
-
"/grill-me",
|
|
214870
|
-
"/login",
|
|
214871
|
-
"/logout",
|
|
214872
|
-
"/exit",
|
|
214873
|
-
"/model",
|
|
214874
|
-
"/plan",
|
|
214875
|
-
"/resume",
|
|
214876
|
-
"/settings",
|
|
214877
|
-
"/context",
|
|
214878
|
-
"/tasks",
|
|
214879
|
-
"/usage",
|
|
214880
|
-
"/feedback",
|
|
214881
|
-
"/mcp"
|
|
214882
|
-
];
|
|
214883
|
-
if (forwardCommands.includes(command.value) || !command.action) {
|
|
214884
|
-
if (currentValue.length > command.value.length && currentValue.toLowerCase().startsWith(command.value.toLowerCase())) {
|
|
214885
|
-
onSubmit(currentValue);
|
|
214886
|
-
} else {
|
|
214887
|
-
onSubmit(command.value);
|
|
214888
214869
|
}
|
|
214889
|
-
|
|
214890
|
-
|
|
214891
|
-
|
|
214892
|
-
|
|
214893
|
-
|
|
214894
|
-
|
|
214895
|
-
|
|
214896
|
-
|
|
214897
|
-
|
|
214898
|
-
|
|
214899
|
-
|
|
214900
|
-
|
|
214901
|
-
|
|
214902
|
-
|
|
214903
|
-
|
|
214904
|
-
|
|
214905
|
-
|
|
214906
|
-
|
|
214907
|
-
|
|
214908
|
-
|
|
214909
|
-
|
|
214910
|
-
|
|
214911
|
-
|
|
214912
|
-
|
|
214913
|
-
|
|
214914
|
-
|
|
214915
|
-
|
|
214916
|
-
|
|
214917
|
-
|
|
214918
|
-
|
|
214919
|
-
|
|
214920
|
-
|
|
214921
|
-
|
|
214922
|
-
|
|
214923
|
-
|
|
214924
|
-
|
|
214925
|
-
|
|
214926
|
-
|
|
214927
|
-
|
|
214928
|
-
|
|
214929
|
-
|
|
214930
|
-
|
|
214931
|
-
|
|
214932
|
-
|
|
214933
|
-
|
|
214934
|
-
|
|
214935
|
-
|
|
214936
|
-
|
|
214937
|
-
|
|
214938
|
-
|
|
214939
|
-
|
|
214940
|
-
|
|
214941
|
-
|
|
214942
|
-
|
|
214943
|
-
|
|
214944
|
-
|
|
214945
|
-
|
|
214946
|
-
|
|
214947
|
-
|
|
214948
|
-
|
|
214949
|
-
|
|
214950
|
-
|
|
214951
|
-
|
|
214952
|
-
|
|
214953
|
-
|
|
214954
|
-
|
|
214955
|
-
|
|
214956
|
-
|
|
214957
|
-
|
|
214958
|
-
|
|
214959
|
-
|
|
214960
|
-
|
|
214961
|
-
|
|
214962
|
-
|
|
214963
|
-
|
|
214964
|
-
|
|
214870
|
+
}, [value2, handleContentChange]);
|
|
214871
|
+
const handleCommand = import_react42.useCallback((command) => {
|
|
214872
|
+
if (!command)
|
|
214873
|
+
return;
|
|
214874
|
+
const currentValue = value2.trim();
|
|
214875
|
+
setValue("");
|
|
214876
|
+
handleContentChange("");
|
|
214877
|
+
const forwardCommands = [
|
|
214878
|
+
"/grill-me",
|
|
214879
|
+
"/login",
|
|
214880
|
+
"/logout",
|
|
214881
|
+
"/exit",
|
|
214882
|
+
"/model",
|
|
214883
|
+
"/plan",
|
|
214884
|
+
"/resume",
|
|
214885
|
+
"/settings",
|
|
214886
|
+
"/context",
|
|
214887
|
+
"/tasks",
|
|
214888
|
+
"/usage",
|
|
214889
|
+
"/feedback",
|
|
214890
|
+
"/mcp",
|
|
214891
|
+
"/update"
|
|
214892
|
+
];
|
|
214893
|
+
if (forwardCommands.includes(command.value) || !command.action) {
|
|
214894
|
+
if (currentValue.length > command.value.length && currentValue.toLowerCase().startsWith(command.value.toLowerCase())) {
|
|
214895
|
+
onSubmit(currentValue);
|
|
214896
|
+
} else {
|
|
214897
|
+
onSubmit(command.value);
|
|
214898
|
+
}
|
|
214899
|
+
return;
|
|
214900
|
+
}
|
|
214901
|
+
if (command.action) {
|
|
214902
|
+
command.action({
|
|
214903
|
+
exit: () => process.exit(0),
|
|
214904
|
+
toast,
|
|
214905
|
+
dialog,
|
|
214906
|
+
agent: agent2,
|
|
214907
|
+
resetChat,
|
|
214908
|
+
onUpdateSuccess
|
|
214909
|
+
});
|
|
214910
|
+
}
|
|
214911
|
+
}, [toast, dialog, agent2, resetChat, onUpdateSuccess, handleContentChange, onSubmit, value2]);
|
|
214912
|
+
const handleSubmit = import_react42.useCallback((text3) => {
|
|
214913
|
+
if (disabled)
|
|
214914
|
+
return;
|
|
214915
|
+
if (showCommandMenu) {
|
|
214916
|
+
const command = resolveCommand(selectedIndex);
|
|
214917
|
+
handleCommand(command);
|
|
214918
|
+
return;
|
|
214919
|
+
}
|
|
214920
|
+
if (showShortcutsMenu) {
|
|
214921
|
+
return;
|
|
214922
|
+
}
|
|
214923
|
+
const trimmed = text3.trim();
|
|
214924
|
+
if (trimmed.length === 0)
|
|
214925
|
+
return;
|
|
214926
|
+
defaultPromptHistory.append(trimmed);
|
|
214927
|
+
defaultPromptHistory.resetCursor();
|
|
214928
|
+
onSubmit(trimmed);
|
|
214929
|
+
setValue("");
|
|
214930
|
+
handleContentChange("");
|
|
214931
|
+
}, [
|
|
214932
|
+
disabled,
|
|
214933
|
+
showCommandMenu,
|
|
214934
|
+
showShortcutsMenu,
|
|
214935
|
+
resolveCommand,
|
|
214936
|
+
selectedIndex,
|
|
214937
|
+
handleCommand,
|
|
214938
|
+
onSubmit,
|
|
214939
|
+
handleContentChange
|
|
214940
|
+
]);
|
|
214941
|
+
const sepWidth = Math.max(10, columns - THEME.padding.paddingX * 2);
|
|
214942
|
+
const sep4 = "─".repeat(sepWidth);
|
|
214943
|
+
return /* @__PURE__ */ jsx_runtime8.jsxs(Box_default, {
|
|
214944
|
+
flexDirection: "column",
|
|
214945
|
+
paddingX: THEME.padding.paddingX,
|
|
214946
|
+
marginTop: 1,
|
|
214947
|
+
children: [
|
|
214948
|
+
dialog.isOpen && dialog.currentDialog && /* @__PURE__ */ jsx_runtime8.jsx(Box_default, {
|
|
214949
|
+
justifyContent: "flex-end",
|
|
214950
|
+
children: /* @__PURE__ */ jsx_runtime8.jsx(InlineDialog, {
|
|
214951
|
+
config: dialog.currentDialog,
|
|
214952
|
+
close: dialog.close
|
|
214953
|
+
})
|
|
214954
|
+
}),
|
|
214955
|
+
queuedPrompts && queuedPrompts.length > 0 && /* @__PURE__ */ jsx_runtime8.jsx(Box_default, {
|
|
214956
|
+
width: "100%",
|
|
214957
|
+
marginBottom: 0,
|
|
214958
|
+
children: /* @__PURE__ */ jsx_runtime8.jsxs(Text3, {
|
|
214959
|
+
color: THEME.colors.brand,
|
|
214965
214960
|
children: [
|
|
214966
|
-
|
|
214967
|
-
|
|
214968
|
-
children: isSelected ? `${THEME.glyphs.selector} ` : " "
|
|
214969
|
-
}),
|
|
214970
|
-
/* @__PURE__ */ jsx_runtime8.jsx(Text3, {
|
|
214971
|
-
color: isSelected ? THEME.colors.brand : THEME.colors.text,
|
|
214972
|
-
children: file
|
|
214973
|
-
})
|
|
214961
|
+
`Queued (${queuedPrompts.length}): "${queuedPrompts[0]}"`,
|
|
214962
|
+
queuedPrompts.length > 1 ? ` (+${queuedPrompts.length - 1} more)` : ""
|
|
214974
214963
|
]
|
|
214975
|
-
}, file);
|
|
214976
|
-
})
|
|
214977
|
-
}),
|
|
214978
|
-
/* @__PURE__ */ jsx_runtime8.jsx(Box_default, {
|
|
214979
|
-
overflow: "hidden",
|
|
214980
|
-
height: 1,
|
|
214981
|
-
width: "100%",
|
|
214982
|
-
children: /* @__PURE__ */ jsx_runtime8.jsx(Text3, {
|
|
214983
|
-
color: THEME.colors.border,
|
|
214984
|
-
wrap: "truncate",
|
|
214985
|
-
children: sep4
|
|
214986
|
-
})
|
|
214987
|
-
}),
|
|
214988
|
-
/* @__PURE__ */ jsx_runtime8.jsxs(Box_default, {
|
|
214989
|
-
width: "100%",
|
|
214990
|
-
paddingRight: 4,
|
|
214991
|
-
children: [
|
|
214992
|
-
/* @__PURE__ */ jsx_runtime8.jsx(Text3, {
|
|
214993
|
-
color: disabled ? THEME.colors.muted : THEME.colors.brand,
|
|
214994
|
-
children: `${THEME.glyphs.prompt} `
|
|
214995
|
-
}),
|
|
214996
|
-
grillMode && /* @__PURE__ */ jsx_runtime8.jsx(Text3, {
|
|
214997
|
-
color: THEME.colors.brand,
|
|
214998
|
-
children: "/grill-me "
|
|
214999
|
-
}),
|
|
215000
|
-
(!authUI || customInputMode) && /* @__PURE__ */ jsx_runtime8.jsx(TextArea, {
|
|
215001
|
-
value: value2,
|
|
215002
|
-
onChange: handleChange,
|
|
215003
|
-
onSubmit: handleSubmit,
|
|
215004
|
-
onHistoryUp: handleHistoryUp,
|
|
215005
|
-
onHistoryDown: handleHistoryDown,
|
|
215006
|
-
placeholder: customInputMode ? "Type your custom answer..." : grillMode ? "" : placeholder,
|
|
215007
|
-
focus: !disabled && !dialog.isOpen,
|
|
215008
|
-
disableHistoryNav: showCommandMenu || showFileMenu || showShortcutsMenu
|
|
215009
214964
|
})
|
|
215010
|
-
|
|
215011
|
-
|
|
215012
|
-
|
|
215013
|
-
|
|
215014
|
-
|
|
215015
|
-
|
|
215016
|
-
|
|
215017
|
-
|
|
215018
|
-
|
|
215019
|
-
children: sep4
|
|
215020
|
-
})
|
|
215021
|
-
}),
|
|
215022
|
-
!showCommandMenu && !showShortcutsMenu && !authUI && /* @__PURE__ */ jsx_runtime8.jsxs(Box_default, {
|
|
215023
|
-
width: "100%",
|
|
215024
|
-
justifyContent: "space-between",
|
|
215025
|
-
children: [
|
|
215026
|
-
/* @__PURE__ */ jsx_runtime8.jsx(Box_default, {
|
|
215027
|
-
gap: 2,
|
|
215028
|
-
alignItems: "center",
|
|
215029
|
-
flexShrink: 1,
|
|
215030
|
-
children: /* @__PURE__ */ jsx_runtime8.jsxs(Box_default, {
|
|
214965
|
+
}),
|
|
214966
|
+
showFileMenu && matchingFiles.length > 0 && /* @__PURE__ */ jsx_runtime8.jsx(Box_default, {
|
|
214967
|
+
flexDirection: "column",
|
|
214968
|
+
paddingLeft: 1,
|
|
214969
|
+
marginBottom: 0,
|
|
214970
|
+
children: matchingFiles.map((file, idx) => {
|
|
214971
|
+
const isSelected = idx === selectedFileIndex;
|
|
214972
|
+
return /* @__PURE__ */ jsx_runtime8.jsxs(Box_default, {
|
|
214973
|
+
flexDirection: "row",
|
|
215031
214974
|
gap: 1,
|
|
215032
|
-
flexShrink: 1,
|
|
215033
214975
|
children: [
|
|
215034
|
-
/* @__PURE__ */ jsx_runtime8.
|
|
215035
|
-
color: THEME.colors.muted,
|
|
215036
|
-
children:
|
|
215037
|
-
activeModel,
|
|
215038
|
-
hasBothAuth && authMethod ? ` (${authMethod === "december" ? "December Cloud" : "BYOK"})` : ""
|
|
215039
|
-
]
|
|
214976
|
+
/* @__PURE__ */ jsx_runtime8.jsx(Text3, {
|
|
214977
|
+
color: isSelected ? THEME.colors.brand : THEME.colors.muted,
|
|
214978
|
+
children: isSelected ? `${THEME.glyphs.selector} ` : " "
|
|
215040
214979
|
}),
|
|
215041
|
-
|
|
215042
|
-
|
|
215043
|
-
|
|
215044
|
-
|
|
215045
|
-
"· ",
|
|
215046
|
-
activeToast.message.replace(/\s+/g, " ").trim()
|
|
215047
|
-
]
|
|
215048
|
-
}) : showExitConfirm ? /* @__PURE__ */ jsx_runtime8.jsx(Text3, {
|
|
215049
|
-
color: THEME.colors.muted,
|
|
215050
|
-
children: "· Press Ctrl+C again to exit"
|
|
215051
|
-
}) : null
|
|
214980
|
+
/* @__PURE__ */ jsx_runtime8.jsx(Text3, {
|
|
214981
|
+
color: isSelected ? THEME.colors.brand : THEME.colors.text,
|
|
214982
|
+
children: file
|
|
214983
|
+
})
|
|
215052
214984
|
]
|
|
214985
|
+
}, file);
|
|
214986
|
+
})
|
|
214987
|
+
}),
|
|
214988
|
+
/* @__PURE__ */ jsx_runtime8.jsx(Box_default, {
|
|
214989
|
+
overflow: "hidden",
|
|
214990
|
+
height: 1,
|
|
214991
|
+
width: "100%",
|
|
214992
|
+
children: /* @__PURE__ */ jsx_runtime8.jsx(Text3, {
|
|
214993
|
+
color: THEME.colors.border,
|
|
214994
|
+
wrap: "truncate",
|
|
214995
|
+
children: sep4
|
|
214996
|
+
})
|
|
214997
|
+
}),
|
|
214998
|
+
/* @__PURE__ */ jsx_runtime8.jsxs(Box_default, {
|
|
214999
|
+
width: "100%",
|
|
215000
|
+
paddingRight: 4,
|
|
215001
|
+
children: [
|
|
215002
|
+
/* @__PURE__ */ jsx_runtime8.jsx(Text3, {
|
|
215003
|
+
color: disabled ? THEME.colors.muted : THEME.colors.brand,
|
|
215004
|
+
children: `${THEME.glyphs.prompt} `
|
|
215005
|
+
}),
|
|
215006
|
+
grillMode && /* @__PURE__ */ jsx_runtime8.jsx(Text3, {
|
|
215007
|
+
color: THEME.colors.brand,
|
|
215008
|
+
children: "/grill-me "
|
|
215009
|
+
}),
|
|
215010
|
+
(!authUI || customInputMode) && /* @__PURE__ */ jsx_runtime8.jsx(TextArea, {
|
|
215011
|
+
value: value2,
|
|
215012
|
+
onChange: handleChange,
|
|
215013
|
+
onSubmit: handleSubmit,
|
|
215014
|
+
onHistoryUp: handleHistoryUp,
|
|
215015
|
+
onHistoryDown: handleHistoryDown,
|
|
215016
|
+
placeholder: customInputMode ? "Type your custom answer..." : grillMode ? "" : placeholder,
|
|
215017
|
+
focus: !disabled && !dialog.isOpen,
|
|
215018
|
+
disableHistoryNav: showCommandMenu || showFileMenu || showShortcutsMenu
|
|
215053
215019
|
})
|
|
215054
|
-
|
|
215055
|
-
|
|
215056
|
-
|
|
215057
|
-
|
|
215058
|
-
|
|
215059
|
-
|
|
215060
|
-
|
|
215061
|
-
|
|
215062
|
-
|
|
215020
|
+
]
|
|
215021
|
+
}),
|
|
215022
|
+
/* @__PURE__ */ jsx_runtime8.jsx(Box_default, {
|
|
215023
|
+
overflow: "hidden",
|
|
215024
|
+
height: 1,
|
|
215025
|
+
width: "100%",
|
|
215026
|
+
children: /* @__PURE__ */ jsx_runtime8.jsx(Text3, {
|
|
215027
|
+
color: THEME.colors.border,
|
|
215028
|
+
wrap: "truncate",
|
|
215029
|
+
children: sep4
|
|
215063
215030
|
})
|
|
215064
|
-
|
|
215065
|
-
|
|
215066
|
-
|
|
215067
|
-
|
|
215068
|
-
|
|
215069
|
-
|
|
215070
|
-
|
|
215071
|
-
|
|
215072
|
-
|
|
215073
|
-
|
|
215074
|
-
|
|
215075
|
-
|
|
215076
|
-
|
|
215077
|
-
|
|
215078
|
-
|
|
215079
|
-
|
|
215080
|
-
|
|
215081
|
-
|
|
215082
|
-
|
|
215083
|
-
|
|
215084
|
-
|
|
215085
|
-
|
|
215086
|
-
|
|
215087
|
-
|
|
215031
|
+
}),
|
|
215032
|
+
!showCommandMenu && !showShortcutsMenu && !authUI && /* @__PURE__ */ jsx_runtime8.jsxs(Box_default, {
|
|
215033
|
+
width: "100%",
|
|
215034
|
+
justifyContent: "space-between",
|
|
215035
|
+
children: [
|
|
215036
|
+
/* @__PURE__ */ jsx_runtime8.jsx(Box_default, {
|
|
215037
|
+
gap: 2,
|
|
215038
|
+
alignItems: "center",
|
|
215039
|
+
flexShrink: 1,
|
|
215040
|
+
children: /* @__PURE__ */ jsx_runtime8.jsxs(Box_default, {
|
|
215041
|
+
gap: 1,
|
|
215042
|
+
flexShrink: 1,
|
|
215043
|
+
children: [
|
|
215044
|
+
/* @__PURE__ */ jsx_runtime8.jsxs(Text3, {
|
|
215045
|
+
color: THEME.colors.muted,
|
|
215046
|
+
children: [
|
|
215047
|
+
activeModel,
|
|
215048
|
+
hasBothAuth && authMethod ? ` (${authMethod === "december" ? "December Cloud" : "BYOK"})` : ""
|
|
215049
|
+
]
|
|
215050
|
+
}),
|
|
215051
|
+
activeToast ? /* @__PURE__ */ jsx_runtime8.jsxs(Text3, {
|
|
215052
|
+
wrap: "truncate",
|
|
215053
|
+
color: activeToast.variant === "success" ? THEME.colors.success : activeToast.variant === "error" ? THEME.colors.error : THEME.colors.muted,
|
|
215054
|
+
children: [
|
|
215055
|
+
"· ",
|
|
215056
|
+
activeToast.message.replace(/\s+/g, " ").trim()
|
|
215057
|
+
]
|
|
215058
|
+
}) : showExitConfirm ? /* @__PURE__ */ jsx_runtime8.jsx(Text3, {
|
|
215059
|
+
color: THEME.colors.muted,
|
|
215060
|
+
children: "· Press Ctrl+C again to exit"
|
|
215061
|
+
}) : null
|
|
215062
|
+
]
|
|
215063
|
+
})
|
|
215064
|
+
}),
|
|
215065
|
+
/* @__PURE__ */ jsx_runtime8.jsx(Box_default, {
|
|
215066
|
+
gap: 0,
|
|
215067
|
+
flexShrink: 0,
|
|
215068
|
+
marginLeft: 2,
|
|
215069
|
+
children: /* @__PURE__ */ jsx_runtime8.jsx(Text3, {
|
|
215070
|
+
color: THEME.colors.muted,
|
|
215071
|
+
children: "? for shortcuts"
|
|
215072
|
+
})
|
|
215073
|
+
})
|
|
215074
|
+
]
|
|
215075
|
+
}),
|
|
215076
|
+
authUI && /* @__PURE__ */ jsx_runtime8.jsx(Box_default, {
|
|
215077
|
+
paddingBottom: 1,
|
|
215078
|
+
children: authUI
|
|
215079
|
+
}),
|
|
215080
|
+
showCommandMenu && /* @__PURE__ */ jsx_runtime8.jsx(CommandMenu, {
|
|
215081
|
+
query: commandQuery,
|
|
215082
|
+
selectedIndex,
|
|
215083
|
+
windowStart,
|
|
215084
|
+
totalFiltered: 0,
|
|
215085
|
+
onSelect: setSelectedIndex,
|
|
215086
|
+
onExecute: (index2) => {
|
|
215087
|
+
const command = resolveCommand(index2);
|
|
215088
|
+
handleCommand(command);
|
|
215089
|
+
}
|
|
215090
|
+
}),
|
|
215091
|
+
showShortcutsMenu && /* @__PURE__ */ jsx_runtime8.jsx(ShortcutsMenu, {
|
|
215092
|
+
onClose: () => {
|
|
215093
|
+
setShowShortcutsMenu(false);
|
|
215094
|
+
setValue("");
|
|
215095
|
+
}
|
|
215096
|
+
})
|
|
215097
|
+
]
|
|
215098
|
+
});
|
|
215088
215099
|
});
|
|
215089
|
-
}
|
|
215090
|
-
var import_fast_glob, import_react42, jsx_runtime8, MAX_FILE_SUGGESTIONS = 5;
|
|
215091
|
-
var init_input_bar = __esm(async () => {
|
|
215092
|
-
init_src();
|
|
215093
|
-
init_theme();
|
|
215094
|
-
init_prompt_history();
|
|
215095
|
-
await __promiseAll([
|
|
215096
|
-
init_build2(),
|
|
215097
|
-
init_use_terminal_columns(),
|
|
215098
|
-
init_dialog(),
|
|
215099
|
-
init_toast(),
|
|
215100
|
-
init_command_menu(),
|
|
215101
|
-
init_use_command_menu(),
|
|
215102
|
-
init_shortcuts_menu(),
|
|
215103
|
-
init_text_area()
|
|
215104
|
-
]);
|
|
215105
|
-
import_fast_glob = __toESM(require_out4(), 1);
|
|
215106
|
-
import_react42 = __toESM(require_react(), 1);
|
|
215107
|
-
jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
|
|
215108
215100
|
});
|
|
215109
215101
|
|
|
215110
215102
|
// ../../node_modules/.bun/cli-spinners@2.9.2/node_modules/cli-spinners/spinners.json
|
|
@@ -260469,14 +260461,40 @@ ${r2}`;
|
|
|
260469
260461
|
});
|
|
260470
260462
|
|
|
260471
260463
|
// ../../packages/tui/src/components/header.tsx
|
|
260472
|
-
import
|
|
260464
|
+
import fs18 from "node:fs";
|
|
260473
260465
|
import { homedir } from "node:os";
|
|
260474
|
-
|
|
260475
|
-
|
|
260476
|
-
|
|
260477
|
-
|
|
260478
|
-
return null;
|
|
260466
|
+
import path17 from "node:path";
|
|
260467
|
+
function getGitBranch(workspaceRoot = process.cwd()) {
|
|
260468
|
+
if (cachedBranch !== undefined) {
|
|
260469
|
+
return cachedBranch;
|
|
260479
260470
|
}
|
|
260471
|
+
try {
|
|
260472
|
+
const gitPath = path17.resolve(workspaceRoot, ".git");
|
|
260473
|
+
if (fs18.existsSync(gitPath)) {
|
|
260474
|
+
const stat4 = fs18.statSync(gitPath);
|
|
260475
|
+
let headPath = path17.resolve(gitPath, "HEAD");
|
|
260476
|
+
if (stat4.isFile()) {
|
|
260477
|
+
const content = fs18.readFileSync(gitPath, "utf-8").trim();
|
|
260478
|
+
if (content.startsWith("gitdir:")) {
|
|
260479
|
+
const gitDir = content.slice(7).trim();
|
|
260480
|
+
headPath = path17.resolve(workspaceRoot, gitDir, "HEAD");
|
|
260481
|
+
}
|
|
260482
|
+
}
|
|
260483
|
+
if (fs18.existsSync(headPath)) {
|
|
260484
|
+
const headContent = fs18.readFileSync(headPath, "utf-8").trim();
|
|
260485
|
+
if (headContent.startsWith("ref: refs/heads/")) {
|
|
260486
|
+
cachedBranch = headContent.replace("ref: refs/heads/", "").trim();
|
|
260487
|
+
return cachedBranch;
|
|
260488
|
+
}
|
|
260489
|
+
if (headContent) {
|
|
260490
|
+
cachedBranch = headContent.slice(0, 7);
|
|
260491
|
+
return cachedBranch;
|
|
260492
|
+
}
|
|
260493
|
+
}
|
|
260494
|
+
}
|
|
260495
|
+
} catch {}
|
|
260496
|
+
cachedBranch = null;
|
|
260497
|
+
return null;
|
|
260480
260498
|
}
|
|
260481
260499
|
function getCwd() {
|
|
260482
260500
|
try {
|
|
@@ -260487,81 +260505,82 @@ function getCwd() {
|
|
|
260487
260505
|
return "~";
|
|
260488
260506
|
}
|
|
260489
260507
|
}
|
|
260490
|
-
|
|
260491
|
-
cliVersion = "0.1.0",
|
|
260492
|
-
latestVersion,
|
|
260493
|
-
userEmail
|
|
260494
|
-
}) {
|
|
260495
|
-
const cwd2 = getCwd();
|
|
260496
|
-
const branch = getGitBranch();
|
|
260497
|
-
return /* @__PURE__ */ jsx_runtime14.jsxs(Box_default, {
|
|
260498
|
-
flexDirection: "column",
|
|
260499
|
-
paddingX: THEME.padding.paddingX,
|
|
260500
|
-
paddingTop: 1,
|
|
260501
|
-
paddingBottom: 0,
|
|
260502
|
-
children: [
|
|
260503
|
-
/* @__PURE__ */ jsx_runtime14.jsxs(Text3, {
|
|
260504
|
-
bold: true,
|
|
260505
|
-
color: THEME.colors.text,
|
|
260506
|
-
children: [
|
|
260507
|
-
"✱ December CLI ",
|
|
260508
|
-
cliVersion.replace(/^v/, "")
|
|
260509
|
-
]
|
|
260510
|
-
}),
|
|
260511
|
-
userEmail && /* @__PURE__ */ jsx_runtime14.jsx(Text3, {
|
|
260512
|
-
color: THEME.colors.muted,
|
|
260513
|
-
children: userEmail
|
|
260514
|
-
}),
|
|
260515
|
-
/* @__PURE__ */ jsx_runtime14.jsxs(Box_default, {
|
|
260516
|
-
gap: 1,
|
|
260517
|
-
children: [
|
|
260518
|
-
/* @__PURE__ */ jsx_runtime14.jsx(Text3, {
|
|
260519
|
-
color: THEME.colors.muted,
|
|
260520
|
-
children: cwd2
|
|
260521
|
-
}),
|
|
260522
|
-
branch && /* @__PURE__ */ jsx_runtime14.jsxs(Text3, {
|
|
260523
|
-
color: THEME.colors.muted,
|
|
260524
|
-
children: [
|
|
260525
|
-
"(",
|
|
260526
|
-
branch,
|
|
260527
|
-
")"
|
|
260528
|
-
]
|
|
260529
|
-
})
|
|
260530
|
-
]
|
|
260531
|
-
}),
|
|
260532
|
-
/* @__PURE__ */ jsx_runtime14.jsxs(Box_default, {
|
|
260533
|
-
flexDirection: "column",
|
|
260534
|
-
marginTop: 1,
|
|
260535
|
-
children: [
|
|
260536
|
-
/* @__PURE__ */ jsx_runtime14.jsx(Text3, {
|
|
260537
|
-
color: THEME.colors.brand,
|
|
260538
|
-
children: "Tips for getting started"
|
|
260539
|
-
}),
|
|
260540
|
-
/* @__PURE__ */ jsx_runtime14.jsx(Text3, {
|
|
260541
|
-
color: THEME.colors.muted,
|
|
260542
|
-
children: "Run /init to scaffold .december workspace for custom rules and skills"
|
|
260543
|
-
}),
|
|
260544
|
-
/* @__PURE__ */ jsx_runtime14.jsx(Text3, {
|
|
260545
|
-
color: THEME.colors.muted,
|
|
260546
|
-
children: "Use /handoff to continue this session in December (trydecember.com)"
|
|
260547
|
-
}),
|
|
260548
|
-
latestVersion && /* @__PURE__ */ jsx_runtime14.jsxs(Text3, {
|
|
260549
|
-
color: THEME.colors.muted,
|
|
260550
|
-
children: [
|
|
260551
|
-
"Run /update to install December CLI ",
|
|
260552
|
-
latestVersion
|
|
260553
|
-
]
|
|
260554
|
-
})
|
|
260555
|
-
]
|
|
260556
|
-
})
|
|
260557
|
-
]
|
|
260558
|
-
});
|
|
260559
|
-
}
|
|
260560
|
-
var jsx_runtime14;
|
|
260508
|
+
var import_react47, jsx_runtime14, cachedBranch = undefined, Header;
|
|
260561
260509
|
var init_header = __esm(async () => {
|
|
260562
260510
|
init_theme();
|
|
260563
260511
|
await init_build2();
|
|
260512
|
+
import_react47 = __toESM(require_react(), 1);
|
|
260564
260513
|
jsx_runtime14 = __toESM(require_jsx_runtime(), 1);
|
|
260514
|
+
Header = import_react47.default.memo(function Header2({
|
|
260515
|
+
cliVersion = "0.1.0",
|
|
260516
|
+
latestVersion,
|
|
260517
|
+
userEmail
|
|
260518
|
+
}) {
|
|
260519
|
+
const cwd2 = getCwd();
|
|
260520
|
+
const branch = getGitBranch();
|
|
260521
|
+
return /* @__PURE__ */ jsx_runtime14.jsxs(Box_default, {
|
|
260522
|
+
flexDirection: "column",
|
|
260523
|
+
paddingX: THEME.padding.paddingX,
|
|
260524
|
+
paddingTop: 1,
|
|
260525
|
+
paddingBottom: 0,
|
|
260526
|
+
children: [
|
|
260527
|
+
/* @__PURE__ */ jsx_runtime14.jsxs(Text3, {
|
|
260528
|
+
bold: true,
|
|
260529
|
+
color: THEME.colors.text,
|
|
260530
|
+
children: [
|
|
260531
|
+
"✱ December CLI ",
|
|
260532
|
+
cliVersion.replace(/^v/, "")
|
|
260533
|
+
]
|
|
260534
|
+
}),
|
|
260535
|
+
userEmail && /* @__PURE__ */ jsx_runtime14.jsx(Text3, {
|
|
260536
|
+
color: THEME.colors.muted,
|
|
260537
|
+
children: userEmail
|
|
260538
|
+
}),
|
|
260539
|
+
/* @__PURE__ */ jsx_runtime14.jsxs(Box_default, {
|
|
260540
|
+
gap: 1,
|
|
260541
|
+
children: [
|
|
260542
|
+
/* @__PURE__ */ jsx_runtime14.jsx(Text3, {
|
|
260543
|
+
color: THEME.colors.muted,
|
|
260544
|
+
children: cwd2
|
|
260545
|
+
}),
|
|
260546
|
+
branch && /* @__PURE__ */ jsx_runtime14.jsxs(Text3, {
|
|
260547
|
+
color: THEME.colors.muted,
|
|
260548
|
+
children: [
|
|
260549
|
+
"(",
|
|
260550
|
+
branch,
|
|
260551
|
+
")"
|
|
260552
|
+
]
|
|
260553
|
+
})
|
|
260554
|
+
]
|
|
260555
|
+
}),
|
|
260556
|
+
/* @__PURE__ */ jsx_runtime14.jsxs(Box_default, {
|
|
260557
|
+
flexDirection: "column",
|
|
260558
|
+
marginTop: 1,
|
|
260559
|
+
children: [
|
|
260560
|
+
/* @__PURE__ */ jsx_runtime14.jsx(Text3, {
|
|
260561
|
+
color: THEME.colors.brand,
|
|
260562
|
+
children: "Tips for getting started"
|
|
260563
|
+
}),
|
|
260564
|
+
/* @__PURE__ */ jsx_runtime14.jsx(Text3, {
|
|
260565
|
+
color: THEME.colors.muted,
|
|
260566
|
+
children: "Run /init to scaffold .december workspace for custom rules and skills"
|
|
260567
|
+
}),
|
|
260568
|
+
/* @__PURE__ */ jsx_runtime14.jsx(Text3, {
|
|
260569
|
+
color: THEME.colors.muted,
|
|
260570
|
+
children: "Use /handoff to continue this session in December (trydecember.com)"
|
|
260571
|
+
}),
|
|
260572
|
+
latestVersion && /* @__PURE__ */ jsx_runtime14.jsxs(Text3, {
|
|
260573
|
+
color: THEME.colors.muted,
|
|
260574
|
+
children: [
|
|
260575
|
+
"Run /update to install December CLI ",
|
|
260576
|
+
latestVersion
|
|
260577
|
+
]
|
|
260578
|
+
})
|
|
260579
|
+
]
|
|
260580
|
+
})
|
|
260581
|
+
]
|
|
260582
|
+
});
|
|
260583
|
+
});
|
|
260565
260584
|
});
|
|
260566
260585
|
|
|
260567
260586
|
// ../../packages/tui/src/components/messages/error-message.tsx
|
|
@@ -260589,13 +260608,13 @@ var init_error_message = __esm(async () => {
|
|
|
260589
260608
|
});
|
|
260590
260609
|
|
|
260591
260610
|
// ../../packages/tui/src/components/messages/user-message.tsx
|
|
260592
|
-
var
|
|
260611
|
+
var import_react48, jsx_runtime16, UserMessage;
|
|
260593
260612
|
var init_user_message = __esm(async () => {
|
|
260594
260613
|
init_theme();
|
|
260595
260614
|
await init_build2();
|
|
260596
|
-
|
|
260615
|
+
import_react48 = __toESM(require_react(), 1);
|
|
260597
260616
|
jsx_runtime16 = __toESM(require_jsx_runtime(), 1);
|
|
260598
|
-
UserMessage =
|
|
260617
|
+
UserMessage = import_react48.default.memo(function UserMessage2({ message }) {
|
|
260599
260618
|
return /* @__PURE__ */ jsx_runtime16.jsxs(Box_default, {
|
|
260600
260619
|
paddingX: THEME.padding.paddingX,
|
|
260601
260620
|
paddingY: 0,
|
|
@@ -260650,23 +260669,7 @@ function renderSingleMessage(msg, index2, allMessages, cliVersion, latestVersion
|
|
|
260650
260669
|
expandCommands
|
|
260651
260670
|
}, key);
|
|
260652
260671
|
}
|
|
260653
|
-
|
|
260654
|
-
staticKey,
|
|
260655
|
-
staticMessages,
|
|
260656
|
-
activeMessages,
|
|
260657
|
-
isAuthenticated,
|
|
260658
|
-
cliVersion,
|
|
260659
|
-
latestVersion,
|
|
260660
|
-
userEmail,
|
|
260661
|
-
expandCommands
|
|
260662
|
-
}) {
|
|
260663
|
-
const allMessages = [...staticMessages, ...activeMessages];
|
|
260664
|
-
return /* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
|
|
260665
|
-
flexDirection: "column",
|
|
260666
|
-
children: allMessages.map((msg, index2) => renderSingleMessage(msg, index2, allMessages, cliVersion, latestVersion, userEmail, expandCommands))
|
|
260667
|
-
});
|
|
260668
|
-
}
|
|
260669
|
-
var jsx_runtime17;
|
|
260672
|
+
var import_react49, jsx_runtime17, MessageList;
|
|
260670
260673
|
var init_message_list = __esm(async () => {
|
|
260671
260674
|
await __promiseAll([
|
|
260672
260675
|
init_build2(),
|
|
@@ -260675,7 +260678,24 @@ var init_message_list = __esm(async () => {
|
|
|
260675
260678
|
init_error_message(),
|
|
260676
260679
|
init_user_message()
|
|
260677
260680
|
]);
|
|
260681
|
+
import_react49 = __toESM(require_react(), 1);
|
|
260678
260682
|
jsx_runtime17 = __toESM(require_jsx_runtime(), 1);
|
|
260683
|
+
MessageList = import_react49.default.memo(function MessageList2({
|
|
260684
|
+
staticKey,
|
|
260685
|
+
staticMessages,
|
|
260686
|
+
activeMessages,
|
|
260687
|
+
isAuthenticated,
|
|
260688
|
+
cliVersion,
|
|
260689
|
+
latestVersion,
|
|
260690
|
+
userEmail,
|
|
260691
|
+
expandCommands
|
|
260692
|
+
}) {
|
|
260693
|
+
const allMessages = [...staticMessages, ...activeMessages];
|
|
260694
|
+
return /* @__PURE__ */ jsx_runtime17.jsx(Box_default, {
|
|
260695
|
+
flexDirection: "column",
|
|
260696
|
+
children: allMessages.map((msg, index2) => renderSingleMessage(msg, index2, allMessages, cliVersion, latestVersion, userEmail, expandCommands))
|
|
260697
|
+
});
|
|
260698
|
+
});
|
|
260679
260699
|
});
|
|
260680
260700
|
// ../../packages/tui/src/providers/theme/index.tsx
|
|
260681
260701
|
function ThemeProvider({ children: children2 }) {
|
|
@@ -260684,12 +260704,12 @@ function ThemeProvider({ children: children2 }) {
|
|
|
260684
260704
|
children: children2
|
|
260685
260705
|
});
|
|
260686
260706
|
}
|
|
260687
|
-
var
|
|
260707
|
+
var import_react50, jsx_runtime18, ThemeContext;
|
|
260688
260708
|
var init_theme2 = __esm(() => {
|
|
260689
260709
|
init_theme();
|
|
260690
|
-
|
|
260710
|
+
import_react50 = __toESM(require_react(), 1);
|
|
260691
260711
|
jsx_runtime18 = __toESM(require_jsx_runtime(), 1);
|
|
260692
|
-
ThemeContext =
|
|
260712
|
+
ThemeContext = import_react50.createContext({ colors: COLORS });
|
|
260693
260713
|
});
|
|
260694
260714
|
|
|
260695
260715
|
// ../../packages/tui/src/layouts/root-layout.tsx
|
|
@@ -260736,12 +260756,12 @@ var init_menu_items = __esm(async () => {
|
|
|
260736
260756
|
|
|
260737
260757
|
// ../../node_modules/.bun/ink-text-input@6.0.0+99d24c251f842efe/node_modules/ink-text-input/build/index.js
|
|
260738
260758
|
function TextInput({ value: originalValue, placeholder = "", focus = true, mask, highlightPastedText = false, showCursor = true, onChange, onSubmit }) {
|
|
260739
|
-
const [state, setState] =
|
|
260759
|
+
const [state, setState] = import_react51.useState({
|
|
260740
260760
|
cursorOffset: (originalValue || "").length,
|
|
260741
260761
|
cursorWidth: 0
|
|
260742
260762
|
});
|
|
260743
260763
|
const { cursorOffset, cursorWidth } = state;
|
|
260744
|
-
|
|
260764
|
+
import_react51.useEffect(() => {
|
|
260745
260765
|
setState((previousState) => {
|
|
260746
260766
|
if (!focus || !showCursor) {
|
|
260747
260767
|
return previousState;
|
|
@@ -260819,13 +260839,13 @@ function TextInput({ value: originalValue, placeholder = "", focus = true, mask,
|
|
|
260819
260839
|
onChange(nextValue);
|
|
260820
260840
|
}
|
|
260821
260841
|
}, { isActive: focus });
|
|
260822
|
-
return
|
|
260842
|
+
return import_react51.default.createElement(Text3, null, placeholder ? value2.length > 0 ? renderedValue : renderedPlaceholder : renderedValue);
|
|
260823
260843
|
}
|
|
260824
|
-
var
|
|
260844
|
+
var import_react51, build_default2;
|
|
260825
260845
|
var init_build4 = __esm(async () => {
|
|
260826
260846
|
init_source();
|
|
260827
260847
|
await init_build2();
|
|
260828
|
-
|
|
260848
|
+
import_react51 = __toESM(require_react(), 1);
|
|
260829
260849
|
build_default2 = TextInput;
|
|
260830
260850
|
});
|
|
260831
260851
|
|
|
@@ -261214,24 +261234,24 @@ var init_figures = __esm(() => {
|
|
|
261214
261234
|
|
|
261215
261235
|
// ../../node_modules/.bun/ink-select-input@6.2.0+99d24c251f842efe/node_modules/ink-select-input/build/Indicator.js
|
|
261216
261236
|
function Indicator({ isSelected = false }) {
|
|
261217
|
-
return
|
|
261237
|
+
return import_react52.default.createElement(Box_default, { marginRight: 1 }, isSelected ? import_react52.default.createElement(Text3, { color: "blue" }, figures_default.pointer) : import_react52.default.createElement(Text3, null, " "));
|
|
261218
261238
|
}
|
|
261219
|
-
var
|
|
261239
|
+
var import_react52, Indicator_default;
|
|
261220
261240
|
var init_Indicator = __esm(async () => {
|
|
261221
261241
|
init_figures();
|
|
261222
261242
|
await init_build2();
|
|
261223
|
-
|
|
261243
|
+
import_react52 = __toESM(require_react(), 1);
|
|
261224
261244
|
Indicator_default = Indicator;
|
|
261225
261245
|
});
|
|
261226
261246
|
|
|
261227
261247
|
// ../../node_modules/.bun/ink-select-input@6.2.0+99d24c251f842efe/node_modules/ink-select-input/build/Item.js
|
|
261228
261248
|
function Item({ isSelected = false, label }) {
|
|
261229
|
-
return
|
|
261249
|
+
return React25.createElement(Text3, { color: isSelected ? "blue" : undefined }, label);
|
|
261230
261250
|
}
|
|
261231
|
-
var
|
|
261251
|
+
var React25, Item_default;
|
|
261232
261252
|
var init_Item = __esm(async () => {
|
|
261233
261253
|
await init_build2();
|
|
261234
|
-
|
|
261254
|
+
React25 = __toESM(require_react(), 1);
|
|
261235
261255
|
Item_default = Item;
|
|
261236
261256
|
});
|
|
261237
261257
|
|
|
@@ -261263,17 +261283,17 @@ function SelectInput({ items = [], isFocused = true, initialIndex = 0, indicator
|
|
|
261263
261283
|
const hasLimit = typeof customLimit === "number" && items.length > customLimit;
|
|
261264
261284
|
const limit3 = hasLimit ? Math.min(customLimit, items.length) : items.length;
|
|
261265
261285
|
const lastIndex = limit3 - 1;
|
|
261266
|
-
const [rotateIndex, setRotateIndex] =
|
|
261267
|
-
const [selectedIndex, setSelectedIndex] =
|
|
261268
|
-
const previousItems =
|
|
261269
|
-
|
|
261286
|
+
const [rotateIndex, setRotateIndex] = import_react53.useState(initialIndex > lastIndex ? lastIndex - initialIndex : 0);
|
|
261287
|
+
const [selectedIndex, setSelectedIndex] = import_react53.useState(initialIndex ? initialIndex > lastIndex ? lastIndex : initialIndex : 0);
|
|
261288
|
+
const previousItems = import_react53.useRef(items);
|
|
261289
|
+
import_react53.useEffect(() => {
|
|
261270
261290
|
if (!isDeepStrictEqual(previousItems.current.map((item) => item.value), items.map((item) => item.value))) {
|
|
261271
261291
|
setRotateIndex(0);
|
|
261272
261292
|
setSelectedIndex(0);
|
|
261273
261293
|
}
|
|
261274
261294
|
previousItems.current = items;
|
|
261275
261295
|
}, [items]);
|
|
261276
|
-
use_input_default(
|
|
261296
|
+
use_input_default(import_react53.useCallback((input, key) => {
|
|
261277
261297
|
if (input === "k" || key.upArrow) {
|
|
261278
261298
|
const lastIndex2 = (hasLimit ? limit3 : items.length) - 1;
|
|
261279
261299
|
const atFirstIndex = selectedIndex === 0;
|
|
@@ -261325,19 +261345,19 @@ function SelectInput({ items = [], isFocused = true, initialIndex = 0, indicator
|
|
|
261325
261345
|
onHighlight
|
|
261326
261346
|
]), { isActive: isFocused });
|
|
261327
261347
|
const slicedItems = hasLimit ? toRotated(items, rotateIndex).slice(0, limit3) : items;
|
|
261328
|
-
return
|
|
261348
|
+
return import_react53.default.createElement(Box_default, { flexDirection: "column" }, slicedItems.map((item, index2) => {
|
|
261329
261349
|
const isSelected = index2 === selectedIndex;
|
|
261330
|
-
return
|
|
261350
|
+
return import_react53.default.createElement(Box_default, { key: item.key ?? item.value }, import_react53.default.createElement(indicatorComponent, { isSelected }), import_react53.default.createElement(itemComponent, { ...item, isSelected }));
|
|
261331
261351
|
}));
|
|
261332
261352
|
}
|
|
261333
|
-
var
|
|
261353
|
+
var import_react53, SelectInput_default;
|
|
261334
261354
|
var init_SelectInput = __esm(async () => {
|
|
261335
261355
|
await __promiseAll([
|
|
261336
261356
|
init_build2(),
|
|
261337
261357
|
init_Indicator(),
|
|
261338
261358
|
init_Item()
|
|
261339
261359
|
]);
|
|
261340
|
-
|
|
261360
|
+
import_react53 = __toESM(require_react(), 1);
|
|
261341
261361
|
SelectInput_default = SelectInput;
|
|
261342
261362
|
});
|
|
261343
261363
|
|
|
@@ -261882,7 +261902,7 @@ function McpManagerMenu({
|
|
|
261882
261902
|
setAuthMode
|
|
261883
261903
|
}) {
|
|
261884
261904
|
const serverInfos = propServerInfos || (agent2?.mcpPool ? agent2.mcpPool.getServerInfos() : []);
|
|
261885
|
-
const [selectedIndex, setSelectedIndex] =
|
|
261905
|
+
const [selectedIndex, setSelectedIndex] = import_react54.useState(0);
|
|
261886
261906
|
use_input_default((input, key) => {
|
|
261887
261907
|
if (key.escape) {
|
|
261888
261908
|
setAuthMode("none");
|
|
@@ -262053,14 +262073,14 @@ function McpManagerMenu({
|
|
|
262053
262073
|
]
|
|
262054
262074
|
});
|
|
262055
262075
|
}
|
|
262056
|
-
var
|
|
262076
|
+
var import_react54, jsx_runtime26;
|
|
262057
262077
|
var init_mcp_manager_menu = __esm(async () => {
|
|
262058
262078
|
init_theme();
|
|
262059
262079
|
await __promiseAll([
|
|
262060
262080
|
init_build2(),
|
|
262061
262081
|
init_menu_footer()
|
|
262062
262082
|
]);
|
|
262063
|
-
|
|
262083
|
+
import_react54 = __toESM(require_react(), 1);
|
|
262064
262084
|
jsx_runtime26 = __toESM(require_jsx_runtime(), 1);
|
|
262065
262085
|
});
|
|
262066
262086
|
|
|
@@ -262160,8 +262180,8 @@ var init_model_select_menu = __esm(async () => {
|
|
|
262160
262180
|
|
|
262161
262181
|
// ../../packages/tui/src/components/menus/ollama-setup-menu.tsx
|
|
262162
262182
|
function OllamaSetupMenu({ status, onRetry, onCancel, onProceed }) {
|
|
262163
|
-
const [isEditingUrl, setIsEditingUrl] =
|
|
262164
|
-
const [customUrl, setCustomUrl] =
|
|
262183
|
+
const [isEditingUrl, setIsEditingUrl] = import_react55.useState(false);
|
|
262184
|
+
const [customUrl, setCustomUrl] = import_react55.useState(status?.baseUrl || "http://localhost:11434");
|
|
262165
262185
|
const isRunning = status?.running ?? false;
|
|
262166
262186
|
const compatibleModels = status?.compatibleModels ?? [];
|
|
262167
262187
|
const hasCompatibleModel = compatibleModels.length > 0;
|
|
@@ -262324,7 +262344,7 @@ function OllamaSetupMenu({ status, onRetry, onCancel, onProceed }) {
|
|
|
262324
262344
|
]
|
|
262325
262345
|
});
|
|
262326
262346
|
}
|
|
262327
|
-
var
|
|
262347
|
+
var import_react55, jsx_runtime29;
|
|
262328
262348
|
var init_ollama_setup_menu = __esm(async () => {
|
|
262329
262349
|
init_theme();
|
|
262330
262350
|
await __promiseAll([
|
|
@@ -262334,7 +262354,7 @@ var init_ollama_setup_menu = __esm(async () => {
|
|
|
262334
262354
|
init_menu_footer(),
|
|
262335
262355
|
init_menu_items()
|
|
262336
262356
|
]);
|
|
262337
|
-
|
|
262357
|
+
import_react55 = __toESM(require_react(), 1);
|
|
262338
262358
|
jsx_runtime29 = __toESM(require_jsx_runtime(), 1);
|
|
262339
262359
|
});
|
|
262340
262360
|
|
|
@@ -262438,11 +262458,11 @@ function SessionSelectMenu(props) {
|
|
|
262438
262458
|
handleSessionSelect,
|
|
262439
262459
|
setAuthMode
|
|
262440
262460
|
} = props;
|
|
262441
|
-
const [isSearching, setIsSearching] =
|
|
262442
|
-
const [searchQuery, setSearchQuery] =
|
|
262461
|
+
const [isSearching, setIsSearching] = import_react56.useState(false);
|
|
262462
|
+
const [searchQuery, setSearchQuery] = import_react56.useState("");
|
|
262443
262463
|
const columns = useTerminalColumns();
|
|
262444
262464
|
const SESSION_PAGE_SIZE = 10;
|
|
262445
|
-
const filteredSessions =
|
|
262465
|
+
const filteredSessions = import_react56.useMemo(() => {
|
|
262446
262466
|
if (!searchQuery.trim())
|
|
262447
262467
|
return sessionsData;
|
|
262448
262468
|
const q2 = searchQuery.toLowerCase();
|
|
@@ -262456,11 +262476,11 @@ function SessionSelectMenu(props) {
|
|
|
262456
262476
|
const maxPage = Math.max(0, Math.ceil(totalItems / SESSION_PAGE_SIZE) - 1);
|
|
262457
262477
|
const startIndex = sessionPage * SESSION_PAGE_SIZE;
|
|
262458
262478
|
const visibleItems = filteredSessions.slice(startIndex, startIndex + SESSION_PAGE_SIZE);
|
|
262459
|
-
const selectedIdxRef =
|
|
262479
|
+
const selectedIdxRef = import_react56.useRef(sessionSelectedIndex);
|
|
262460
262480
|
selectedIdxRef.current = sessionSelectedIndex;
|
|
262461
|
-
const pageRef =
|
|
262481
|
+
const pageRef = import_react56.useRef(sessionPage);
|
|
262462
262482
|
pageRef.current = sessionPage;
|
|
262463
|
-
const isSearchingRef =
|
|
262483
|
+
const isSearchingRef = import_react56.useRef(isSearching);
|
|
262464
262484
|
isSearchingRef.current = isSearching;
|
|
262465
262485
|
const timeAgo = (date7) => {
|
|
262466
262486
|
if (!date7)
|
|
@@ -262754,7 +262774,7 @@ function SessionSelectMenu(props) {
|
|
|
262754
262774
|
]
|
|
262755
262775
|
});
|
|
262756
262776
|
}
|
|
262757
|
-
var
|
|
262777
|
+
var import_react56, jsx_runtime31;
|
|
262758
262778
|
var init_session_select_menu = __esm(async () => {
|
|
262759
262779
|
init_theme();
|
|
262760
262780
|
await __promiseAll([
|
|
@@ -262763,7 +262783,7 @@ var init_session_select_menu = __esm(async () => {
|
|
|
262763
262783
|
init_use_terminal_columns(),
|
|
262764
262784
|
init_menu_footer()
|
|
262765
262785
|
]);
|
|
262766
|
-
|
|
262786
|
+
import_react56 = __toESM(require_react(), 1);
|
|
262767
262787
|
jsx_runtime31 = __toESM(require_jsx_runtime(), 1);
|
|
262768
262788
|
});
|
|
262769
262789
|
|
|
@@ -263326,13 +263346,13 @@ var init_auth_menus = __esm(async () => {
|
|
|
263326
263346
|
|
|
263327
263347
|
// ../../packages/tui/src/components/menus/ask-question-menu.tsx
|
|
263328
263348
|
function AskQuestionMenu({ questions, onComplete }) {
|
|
263329
|
-
const [currentQuestionIdx, setCurrentQuestionIdx] =
|
|
263330
|
-
const [answers, setAnswers] =
|
|
263331
|
-
const [selectedIndex, setSelectedIndex] =
|
|
263332
|
-
const [selectedMultiIndices, setSelectedMultiIndices] =
|
|
263333
|
-
const selectedIndexRef =
|
|
263349
|
+
const [currentQuestionIdx, setCurrentQuestionIdx] = import_react57.useState(0);
|
|
263350
|
+
const [answers, setAnswers] = import_react57.useState([]);
|
|
263351
|
+
const [selectedIndex, setSelectedIndex] = import_react57.useState(0);
|
|
263352
|
+
const [selectedMultiIndices, setSelectedMultiIndices] = import_react57.useState(new Set);
|
|
263353
|
+
const selectedIndexRef = import_react57.useRef(0);
|
|
263334
263354
|
selectedIndexRef.current = selectedIndex;
|
|
263335
|
-
const selectedMultiRef =
|
|
263355
|
+
const selectedMultiRef = import_react57.useRef(new Set);
|
|
263336
263356
|
selectedMultiRef.current = selectedMultiIndices;
|
|
263337
263357
|
const currentQ = questions[currentQuestionIdx];
|
|
263338
263358
|
const isMulti = Boolean(currentQ?.is_multi_select);
|
|
@@ -263455,14 +263475,14 @@ function AskQuestionMenu({ questions, onComplete }) {
|
|
|
263455
263475
|
]
|
|
263456
263476
|
});
|
|
263457
263477
|
}
|
|
263458
|
-
var
|
|
263478
|
+
var import_react57, jsx_runtime36;
|
|
263459
263479
|
var init_ask_question_menu = __esm(async () => {
|
|
263460
263480
|
init_theme();
|
|
263461
263481
|
await __promiseAll([
|
|
263462
263482
|
init_build2(),
|
|
263463
263483
|
init_menu_footer()
|
|
263464
263484
|
]);
|
|
263465
|
-
|
|
263485
|
+
import_react57 = __toESM(require_react(), 1);
|
|
263466
263486
|
jsx_runtime36 = __toESM(require_jsx_runtime(), 1);
|
|
263467
263487
|
});
|
|
263468
263488
|
|
|
@@ -263651,8 +263671,8 @@ function ChatApp({
|
|
|
263651
263671
|
onUpdateSuccess,
|
|
263652
263672
|
session
|
|
263653
263673
|
}) {
|
|
263654
|
-
const [exitConfirm, setExitConfirm] =
|
|
263655
|
-
|
|
263674
|
+
const [exitConfirm, setExitConfirm] = import_react58.useState(false);
|
|
263675
|
+
import_react58.useEffect(() => {
|
|
263656
263676
|
if (exitConfirm) {
|
|
263657
263677
|
const timer = setTimeout(() => setExitConfirm(false), 3000);
|
|
263658
263678
|
return () => clearTimeout(timer);
|
|
@@ -263691,7 +263711,7 @@ function ChatApp({
|
|
|
263691
263711
|
agent: agent2,
|
|
263692
263712
|
getProviderModels: session.getProviderModels
|
|
263693
263713
|
}) : null;
|
|
263694
|
-
const handleFormSubmit =
|
|
263714
|
+
const handleFormSubmit = import_react58.useCallback((text3) => {
|
|
263695
263715
|
handleSubmit(text3);
|
|
263696
263716
|
}, [handleSubmit]);
|
|
263697
263717
|
const totalTokens = [...staticMessages, ...activeMessages].reduce((acc, msg) => {
|
|
@@ -263768,7 +263788,7 @@ function ChatApp({
|
|
|
263768
263788
|
]
|
|
263769
263789
|
});
|
|
263770
263790
|
}
|
|
263771
|
-
var
|
|
263791
|
+
var import_react58, jsx_runtime38;
|
|
263772
263792
|
var init_app = __esm(async () => {
|
|
263773
263793
|
await __promiseAll([
|
|
263774
263794
|
init_build2(),
|
|
@@ -263779,7 +263799,7 @@ var init_app = __esm(async () => {
|
|
|
263779
263799
|
init_tool_permission_menu(),
|
|
263780
263800
|
init_message_list()
|
|
263781
263801
|
]);
|
|
263782
|
-
|
|
263802
|
+
import_react58 = __toESM(require_react(), 1);
|
|
263783
263803
|
jsx_runtime38 = __toESM(require_jsx_runtime(), 1);
|
|
263784
263804
|
});
|
|
263785
263805
|
|
|
@@ -263857,25 +263877,25 @@ var exports_file_session_repository = {};
|
|
|
263857
263877
|
__export(exports_file_session_repository, {
|
|
263858
263878
|
FileSessionRepository: () => FileSessionRepository
|
|
263859
263879
|
});
|
|
263860
|
-
import
|
|
263880
|
+
import fs19 from "node:fs/promises";
|
|
263861
263881
|
import os10 from "node:os";
|
|
263862
|
-
import
|
|
263882
|
+
import path18 from "node:path";
|
|
263863
263883
|
|
|
263864
263884
|
class FileSessionRepository {
|
|
263865
263885
|
sessionDir;
|
|
263866
263886
|
sessionCache = {};
|
|
263867
263887
|
constructor(sessionDir) {
|
|
263868
|
-
this.sessionDir = sessionDir ||
|
|
263888
|
+
this.sessionDir = sessionDir || path18.join(os10.homedir(), ".config", "december", "sessions");
|
|
263869
263889
|
}
|
|
263870
263890
|
async saveContext(sessionId, messages) {
|
|
263871
|
-
await
|
|
263872
|
-
const historyPath =
|
|
263891
|
+
await fs19.mkdir(this.sessionDir, { recursive: true });
|
|
263892
|
+
const historyPath = path18.join(this.sessionDir, `${sessionId}.jsonl`);
|
|
263873
263893
|
let existing = this.sessionCache[sessionId];
|
|
263874
263894
|
if (!existing) {
|
|
263875
263895
|
existing = {};
|
|
263876
263896
|
this.sessionCache[sessionId] = existing;
|
|
263877
263897
|
try {
|
|
263878
|
-
const data2 = await
|
|
263898
|
+
const data2 = await fs19.readFile(historyPath, "utf-8");
|
|
263879
263899
|
const lines = data2.split(`
|
|
263880
263900
|
`).filter((l3) => l3.trim().length > 0);
|
|
263881
263901
|
for (const l3 of lines) {
|
|
@@ -263899,13 +263919,13 @@ class FileSessionRepository {
|
|
|
263899
263919
|
}
|
|
263900
263920
|
}
|
|
263901
263921
|
if (appendContent) {
|
|
263902
|
-
await
|
|
263922
|
+
await fs19.appendFile(historyPath, appendContent, "utf-8");
|
|
263903
263923
|
}
|
|
263904
263924
|
}
|
|
263905
263925
|
async loadContext(sessionId) {
|
|
263906
|
-
const historyPath =
|
|
263926
|
+
const historyPath = path18.join(this.sessionDir, `${sessionId}.jsonl`);
|
|
263907
263927
|
try {
|
|
263908
|
-
const data2 = await
|
|
263928
|
+
const data2 = await fs19.readFile(historyPath, "utf-8");
|
|
263909
263929
|
const lines = data2.split(`
|
|
263910
263930
|
`).filter((l3) => l3.trim().length > 0);
|
|
263911
263931
|
const msgMap = new Map;
|
|
@@ -263936,7 +263956,7 @@ class FileSessionRepository {
|
|
|
263936
263956
|
if (msgs.length < lines.length) {
|
|
263937
263957
|
const compacted = msgs.map((m3) => JSON.stringify(m3)).join(`
|
|
263938
263958
|
`);
|
|
263939
|
-
await
|
|
263959
|
+
await fs19.writeFile(historyPath, compacted, "utf-8").catch(() => {});
|
|
263940
263960
|
}
|
|
263941
263961
|
const cacheObj = {};
|
|
263942
263962
|
for (const msg of msgs) {
|
|
@@ -263950,17 +263970,17 @@ class FileSessionRepository {
|
|
|
263950
263970
|
}
|
|
263951
263971
|
async listSessions() {
|
|
263952
263972
|
try {
|
|
263953
|
-
await
|
|
263954
|
-
const files = await
|
|
263973
|
+
await fs19.mkdir(this.sessionDir, { recursive: true });
|
|
263974
|
+
const files = await fs19.readdir(this.sessionDir);
|
|
263955
263975
|
const sessions = [];
|
|
263956
263976
|
for (const file of files) {
|
|
263957
263977
|
if (!file.endsWith(".jsonl"))
|
|
263958
263978
|
continue;
|
|
263959
263979
|
const id = file.replace(".jsonl", "");
|
|
263960
|
-
const filePath =
|
|
263980
|
+
const filePath = path18.join(this.sessionDir, file);
|
|
263961
263981
|
try {
|
|
263962
|
-
const stat4 = await
|
|
263963
|
-
const data2 = await
|
|
263982
|
+
const stat4 = await fs19.stat(filePath);
|
|
263983
|
+
const data2 = await fs19.readFile(filePath, "utf-8");
|
|
263964
263984
|
const lines = data2.split(`
|
|
263965
263985
|
`).filter((l3) => l3.trim().length > 0);
|
|
263966
263986
|
let preview = "";
|
|
@@ -263988,15 +264008,15 @@ class FileSessionRepository {
|
|
|
263988
264008
|
}
|
|
263989
264009
|
}
|
|
263990
264010
|
async deleteSession(sessionId) {
|
|
263991
|
-
const historyPath =
|
|
264011
|
+
const historyPath = path18.join(this.sessionDir, `${sessionId}.jsonl`);
|
|
263992
264012
|
try {
|
|
263993
|
-
await
|
|
264013
|
+
await fs19.unlink(historyPath);
|
|
263994
264014
|
} catch (e2) {}
|
|
263995
264015
|
}
|
|
263996
264016
|
async renameSession(oldSessionId, newSessionId) {
|
|
263997
|
-
const oldPath =
|
|
263998
|
-
const newPath =
|
|
263999
|
-
await
|
|
264017
|
+
const oldPath = path18.join(this.sessionDir, `${oldSessionId}.jsonl`);
|
|
264018
|
+
const newPath = path18.join(this.sessionDir, `${newSessionId}.jsonl`);
|
|
264019
|
+
await fs19.rename(oldPath, newPath);
|
|
264000
264020
|
}
|
|
264001
264021
|
}
|
|
264002
264022
|
var init_file_session_repository = () => {};
|
|
@@ -264093,11 +264113,11 @@ var init_vanilla = () => {};
|
|
|
264093
264113
|
|
|
264094
264114
|
// ../../node_modules/.bun/zustand@5.0.14+93dbe784b8baa420/node_modules/zustand/esm/react.mjs
|
|
264095
264115
|
function useStore(api3, selector = identity2) {
|
|
264096
|
-
const slice3 =
|
|
264097
|
-
|
|
264116
|
+
const slice3 = import_react59.default.useSyncExternalStore(api3.subscribe, import_react59.default.useCallback(() => selector(api3.getState()), [api3, selector]), import_react59.default.useCallback(() => selector(api3.getInitialState()), [api3, selector]));
|
|
264117
|
+
import_react59.default.useDebugValue(slice3);
|
|
264098
264118
|
return slice3;
|
|
264099
264119
|
}
|
|
264100
|
-
var
|
|
264120
|
+
var import_react59, identity2 = (arg) => arg, createImpl = (createState) => {
|
|
264101
264121
|
const api3 = createStore(createState);
|
|
264102
264122
|
const useBoundStore = (selector) => useStore(api3, selector);
|
|
264103
264123
|
Object.assign(useBoundStore, api3);
|
|
@@ -264105,7 +264125,7 @@ var import_react57, identity2 = (arg) => arg, createImpl = (createState) => {
|
|
|
264105
264125
|
}, create5 = (createState) => createState ? createImpl(createState) : createImpl;
|
|
264106
264126
|
var init_react = __esm(() => {
|
|
264107
264127
|
init_vanilla();
|
|
264108
|
-
|
|
264128
|
+
import_react59 = __toESM(require_react(), 1);
|
|
264109
264129
|
});
|
|
264110
264130
|
|
|
264111
264131
|
// ../../node_modules/.bun/zustand@5.0.14+93dbe784b8baa420/node_modules/zustand/esm/index.mjs
|
|
@@ -264256,9 +264276,9 @@ var init_store = __esm(async () => {
|
|
|
264256
264276
|
});
|
|
264257
264277
|
|
|
264258
264278
|
// src/store/interceptors.ts
|
|
264259
|
-
import { execSync
|
|
264260
|
-
import
|
|
264261
|
-
import
|
|
264279
|
+
import { execSync } from "node:child_process";
|
|
264280
|
+
import fs20 from "node:fs/promises";
|
|
264281
|
+
import path19 from "node:path";
|
|
264262
264282
|
async function computeToolCallDiff(toolCall) {
|
|
264263
264283
|
if (toolCall.input?.diff) {
|
|
264264
264284
|
return toolCall.input.diff;
|
|
@@ -264267,11 +264287,11 @@ async function computeToolCallDiff(toolCall) {
|
|
|
264267
264287
|
if (!targetPath)
|
|
264268
264288
|
return;
|
|
264269
264289
|
const cwd2 = process.cwd();
|
|
264270
|
-
const resolved =
|
|
264271
|
-
const relative2 =
|
|
264290
|
+
const resolved = path19.resolve(cwd2, targetPath);
|
|
264291
|
+
const relative2 = path19.relative(cwd2, resolved);
|
|
264272
264292
|
let oldContent = "";
|
|
264273
264293
|
try {
|
|
264274
|
-
oldContent = await
|
|
264294
|
+
oldContent = await fs20.readFile(resolved, "utf-8");
|
|
264275
264295
|
} catch {}
|
|
264276
264296
|
if (toolCall.name === "write_to_file" || toolCall.name === "write") {
|
|
264277
264297
|
const newContent = toolCall.input?.CodeContent ?? toolCall.input?.content ?? "";
|
|
@@ -264335,9 +264355,9 @@ function setupAgentInterceptors(agent2, storeState) {
|
|
|
264335
264355
|
];
|
|
264336
264356
|
if (fileTools.includes(toolCall.name)) {
|
|
264337
264357
|
const cwd2 = process.cwd();
|
|
264338
|
-
const resolved =
|
|
264339
|
-
const relative2 =
|
|
264340
|
-
const isOutside = relative2.startsWith("..") ||
|
|
264358
|
+
const resolved = path19.resolve(cwd2, targetPath);
|
|
264359
|
+
const relative2 = path19.relative(cwd2, resolved);
|
|
264360
|
+
const isOutside = relative2.startsWith("..") || path19.isAbsolute(relative2);
|
|
264341
264361
|
if (!config3.nonWorkspaceAccess && isOutside) {
|
|
264342
264362
|
return {
|
|
264343
264363
|
block: true,
|
|
@@ -264408,10 +264428,10 @@ function setupAgentInterceptors(agent2, storeState) {
|
|
|
264408
264428
|
const targetPath = toolCall.input?.TargetFile || toolCall.input?.AbsolutePath || toolCall.input?.filePath || toolCall.input?.path;
|
|
264409
264429
|
if (targetPath) {
|
|
264410
264430
|
const cwd2 = process.cwd();
|
|
264411
|
-
const resolved =
|
|
264412
|
-
const relative2 =
|
|
264431
|
+
const resolved = path19.resolve(cwd2, targetPath);
|
|
264432
|
+
const relative2 = path19.relative(cwd2, resolved);
|
|
264413
264433
|
try {
|
|
264414
|
-
|
|
264434
|
+
execSync(`git ls-files --error-unmatch "${relative2}"`, {
|
|
264415
264435
|
cwd: cwd2,
|
|
264416
264436
|
stdio: "pipe"
|
|
264417
264437
|
});
|
|
@@ -265243,20 +265263,20 @@ function getToolSummary(name, inputStr) {
|
|
|
265243
265263
|
switch (name) {
|
|
265244
265264
|
case "read_file":
|
|
265245
265265
|
case "view_file": {
|
|
265246
|
-
const
|
|
265247
|
-
return `Read(${
|
|
265266
|
+
const path20 = args.AbsolutePath || args.TargetFile || args.filePath || args.filepath || args.path || args.file || "";
|
|
265267
|
+
return `Read(${path20})`.trim();
|
|
265248
265268
|
}
|
|
265249
265269
|
case "write_file":
|
|
265250
265270
|
case "write_to_file": {
|
|
265251
|
-
const
|
|
265252
|
-
return `Create(${
|
|
265271
|
+
const path20 = args.TargetFile || args.AbsolutePath || args.filePath || args.filepath || args.path || args.file || "";
|
|
265272
|
+
return `Create(${path20})`.trim();
|
|
265253
265273
|
}
|
|
265254
265274
|
case "edit_file":
|
|
265255
265275
|
case "edit_diff":
|
|
265256
265276
|
case "replace_file_content":
|
|
265257
265277
|
case "multi_replace_file_content": {
|
|
265258
|
-
const
|
|
265259
|
-
return `Edit(${
|
|
265278
|
+
const path20 = args.TargetFile || args.AbsolutePath || args.filePath || args.filepath || args.path || args.file || "";
|
|
265279
|
+
return `Edit(${path20})`.trim();
|
|
265260
265280
|
}
|
|
265261
265281
|
case "list_dir":
|
|
265262
265282
|
return `ListDir(${args.DirectoryPath || args.dirPath || args.path || ""})`.trim();
|
|
@@ -266103,6 +266123,271 @@ var init_use_settings_handlers = __esm(async () => {
|
|
|
266103
266123
|
await init_store();
|
|
266104
266124
|
});
|
|
266105
266125
|
|
|
266126
|
+
// src/utils/version-check.ts
|
|
266127
|
+
var exports_version_check = {};
|
|
266128
|
+
__export(exports_version_check, {
|
|
266129
|
+
CHECK_TTL_MS: () => CHECK_TTL_MS,
|
|
266130
|
+
checkForLatestVersion: () => checkForLatestVersion,
|
|
266131
|
+
clearVersionCheckCache: () => clearVersionCheckCache,
|
|
266132
|
+
isNewerVersion: () => isNewerVersion
|
|
266133
|
+
});
|
|
266134
|
+
import https2 from "node:https";
|
|
266135
|
+
function isNewerVersion(current, latest) {
|
|
266136
|
+
const cleanCurrent = current.replace(/^v/, "");
|
|
266137
|
+
const cleanLatest = latest.replace(/^v/, "");
|
|
266138
|
+
const p1 = cleanCurrent.split(".").map((n) => Number(n) || 0);
|
|
266139
|
+
const p2 = cleanLatest.split(".").map((n) => Number(n) || 0);
|
|
266140
|
+
for (let i2 = 0;i2 < Math.max(p1.length, p2.length); i2++) {
|
|
266141
|
+
const v1 = p1[i2] ?? 0;
|
|
266142
|
+
const v2 = p2[i2] ?? 0;
|
|
266143
|
+
if (v2 > v1)
|
|
266144
|
+
return true;
|
|
266145
|
+
if (v1 > v2)
|
|
266146
|
+
return false;
|
|
266147
|
+
}
|
|
266148
|
+
return false;
|
|
266149
|
+
}
|
|
266150
|
+
async function checkForLatestVersion(currentVersion) {
|
|
266151
|
+
try {
|
|
266152
|
+
const config3 = await loadConfig();
|
|
266153
|
+
const now2 = Date.now();
|
|
266154
|
+
if (config3.versionCheckCache) {
|
|
266155
|
+
const { latestVersion, checkedAt } = config3.versionCheckCache;
|
|
266156
|
+
if (now2 - checkedAt < CHECK_TTL_MS) {
|
|
266157
|
+
if (latestVersion && isNewerVersion(currentVersion, latestVersion)) {
|
|
266158
|
+
return latestVersion;
|
|
266159
|
+
}
|
|
266160
|
+
return null;
|
|
266161
|
+
}
|
|
266162
|
+
}
|
|
266163
|
+
const freshLatest = await fetchLatestFromNpm();
|
|
266164
|
+
if (freshLatest) {
|
|
266165
|
+
config3.versionCheckCache = {
|
|
266166
|
+
latestVersion: freshLatest,
|
|
266167
|
+
checkedAt: now2
|
|
266168
|
+
};
|
|
266169
|
+
await saveConfig(config3).catch(() => {});
|
|
266170
|
+
if (isNewerVersion(currentVersion, freshLatest)) {
|
|
266171
|
+
return freshLatest;
|
|
266172
|
+
}
|
|
266173
|
+
}
|
|
266174
|
+
} catch {}
|
|
266175
|
+
return null;
|
|
266176
|
+
}
|
|
266177
|
+
function fetchLatestFromNpm() {
|
|
266178
|
+
return new Promise((resolve4) => {
|
|
266179
|
+
const req = https2.get("https://registry.npmjs.org/@trydecember/cli/latest", { timeout: 1200 }, (res) => {
|
|
266180
|
+
if (res.statusCode !== 200) {
|
|
266181
|
+
resolve4(null);
|
|
266182
|
+
return;
|
|
266183
|
+
}
|
|
266184
|
+
let data2 = "";
|
|
266185
|
+
res.on("data", (chunk2) => {
|
|
266186
|
+
data2 += chunk2;
|
|
266187
|
+
});
|
|
266188
|
+
res.on("end", () => {
|
|
266189
|
+
try {
|
|
266190
|
+
const parsed = JSON.parse(data2);
|
|
266191
|
+
const latest = parsed.version;
|
|
266192
|
+
if (latest && typeof latest === "string") {
|
|
266193
|
+
resolve4(latest);
|
|
266194
|
+
} else {
|
|
266195
|
+
resolve4(null);
|
|
266196
|
+
}
|
|
266197
|
+
} catch {
|
|
266198
|
+
resolve4(null);
|
|
266199
|
+
}
|
|
266200
|
+
});
|
|
266201
|
+
});
|
|
266202
|
+
req.on("error", () => resolve4(null));
|
|
266203
|
+
req.on("timeout", () => {
|
|
266204
|
+
req.destroy();
|
|
266205
|
+
resolve4(null);
|
|
266206
|
+
});
|
|
266207
|
+
});
|
|
266208
|
+
}
|
|
266209
|
+
async function clearVersionCheckCache() {
|
|
266210
|
+
try {
|
|
266211
|
+
const config3 = await loadConfig();
|
|
266212
|
+
if (config3.versionCheckCache) {
|
|
266213
|
+
delete config3.versionCheckCache;
|
|
266214
|
+
await saveConfig(config3);
|
|
266215
|
+
}
|
|
266216
|
+
} catch {}
|
|
266217
|
+
}
|
|
266218
|
+
var CHECK_TTL_MS;
|
|
266219
|
+
var init_version_check = __esm(() => {
|
|
266220
|
+
init_config();
|
|
266221
|
+
CHECK_TTL_MS = 24 * 60 * 60 * 1000;
|
|
266222
|
+
});
|
|
266223
|
+
|
|
266224
|
+
// src/utils/updater.ts
|
|
266225
|
+
var exports_updater = {};
|
|
266226
|
+
__export(exports_updater, {
|
|
266227
|
+
detectInstallMethod: () => detectInstallMethod,
|
|
266228
|
+
getUpdateCommand: () => getUpdateCommand,
|
|
266229
|
+
performCliUpdate: () => performCliUpdate
|
|
266230
|
+
});
|
|
266231
|
+
import { exec as exec5 } from "node:child_process";
|
|
266232
|
+
function detectInstallMethod(options) {
|
|
266233
|
+
const configMethod = options?.configInstallMethod;
|
|
266234
|
+
const validMethods = ["curl", "npm", "bun", "pnpm", "yarn", "brew", "source"];
|
|
266235
|
+
if (configMethod && validMethods.includes(configMethod)) {
|
|
266236
|
+
return configMethod;
|
|
266237
|
+
}
|
|
266238
|
+
const execPath = (options?.execPath ?? process.execPath ?? "").replace(/\\/g, "/");
|
|
266239
|
+
const argv1 = (options?.argv1 ?? (process.argv.length > 1 ? process.argv[1] : "") ?? "").replace(/\\/g, "/");
|
|
266240
|
+
const env8 = options?.env ?? process.env;
|
|
266241
|
+
if (argv1.includes("/apps/cli/src") || argv1.includes("/apps/cli/dist") || argv1.includes("december/apps/cli")) {
|
|
266242
|
+
return "source";
|
|
266243
|
+
}
|
|
266244
|
+
if (execPath.includes("/Cellar/december") || execPath.includes("/opt/homebrew/Cellar/december") || argv1.includes("/Cellar/december") || argv1.includes("/opt/homebrew/bin/december")) {
|
|
266245
|
+
return "brew";
|
|
266246
|
+
}
|
|
266247
|
+
if (execPath.includes(".local/bin/december") || execPath.includes("Programs/december") || env8.DECEMBER_INSTALL_DIR || execPath.endsWith("/december") && !execPath.includes("node_modules") && !execPath.includes("bun") && !execPath.includes("node") || execPath.endsWith("/december.exe") && !execPath.includes("node_modules")) {
|
|
266248
|
+
return "curl";
|
|
266249
|
+
}
|
|
266250
|
+
if (argv1.includes(".bun/bin") || argv1.includes("/.bun/") || execPath.includes("/bun") && !execPath.endsWith("/december")) {
|
|
266251
|
+
return "bun";
|
|
266252
|
+
}
|
|
266253
|
+
if (argv1.includes("pnpm") || argv1.includes(".pnpm") || env8.PNPM_HOME && argv1.includes(env8.PNPM_HOME.replace(/\\/g, "/"))) {
|
|
266254
|
+
return "pnpm";
|
|
266255
|
+
}
|
|
266256
|
+
if (argv1.includes(".yarn/bin") || argv1.includes("/yarn/") || argv1.includes("\\yarn\\")) {
|
|
266257
|
+
return "yarn";
|
|
266258
|
+
}
|
|
266259
|
+
if (argv1.includes("node_modules/@trydecember") || argv1.includes("node_modules/.bin/december") || argv1.includes("/npm/")) {
|
|
266260
|
+
return "npm";
|
|
266261
|
+
}
|
|
266262
|
+
if (execPath.endsWith("/node") || execPath.endsWith("/node.exe")) {
|
|
266263
|
+
return "npm";
|
|
266264
|
+
}
|
|
266265
|
+
return "curl";
|
|
266266
|
+
}
|
|
266267
|
+
function getUpdateCommand(method2, platform4 = process.platform) {
|
|
266268
|
+
switch (method2) {
|
|
266269
|
+
case "curl": {
|
|
266270
|
+
if (platform4 === "win32") {
|
|
266271
|
+
const cmd2 = 'powershell.exe -ExecutionPolicy Bypass -Command "irm https://raw.githubusercontent.com/phasehumans/december/main/install.ps1 | iex"';
|
|
266272
|
+
return {
|
|
266273
|
+
command: cmd2,
|
|
266274
|
+
manualCmd: "irm https://raw.githubusercontent.com/phasehumans/december/main/install.ps1 | iex",
|
|
266275
|
+
description: "Standalone binary via install.ps1"
|
|
266276
|
+
};
|
|
266277
|
+
}
|
|
266278
|
+
const cmd = "curl -fsSL https://raw.githubusercontent.com/phasehumans/december/main/install.sh | bash";
|
|
266279
|
+
return {
|
|
266280
|
+
command: cmd,
|
|
266281
|
+
manualCmd: "curl -fsSL https://raw.githubusercontent.com/phasehumans/december/main/install.sh | bash",
|
|
266282
|
+
description: "Standalone binary via install.sh"
|
|
266283
|
+
};
|
|
266284
|
+
}
|
|
266285
|
+
case "bun": {
|
|
266286
|
+
return {
|
|
266287
|
+
command: "bun install -g @trydecember/cli@latest",
|
|
266288
|
+
manualCmd: "bun install -g @trydecember/cli@latest",
|
|
266289
|
+
description: "Bun global package"
|
|
266290
|
+
};
|
|
266291
|
+
}
|
|
266292
|
+
case "pnpm": {
|
|
266293
|
+
return {
|
|
266294
|
+
command: "pnpm add -g @trydecember/cli@latest",
|
|
266295
|
+
manualCmd: "pnpm add -g @trydecember/cli@latest",
|
|
266296
|
+
description: "PNPM global package"
|
|
266297
|
+
};
|
|
266298
|
+
}
|
|
266299
|
+
case "yarn": {
|
|
266300
|
+
return {
|
|
266301
|
+
command: "yarn global add @trydecember/cli@latest",
|
|
266302
|
+
manualCmd: "yarn global add @trydecember/cli@latest",
|
|
266303
|
+
description: "Yarn global package"
|
|
266304
|
+
};
|
|
266305
|
+
}
|
|
266306
|
+
case "brew": {
|
|
266307
|
+
return {
|
|
266308
|
+
command: "brew upgrade december",
|
|
266309
|
+
manualCmd: "brew upgrade december",
|
|
266310
|
+
description: "Homebrew package"
|
|
266311
|
+
};
|
|
266312
|
+
}
|
|
266313
|
+
case "source": {
|
|
266314
|
+
return {
|
|
266315
|
+
command: "git pull && bun install",
|
|
266316
|
+
manualCmd: "git pull && bun install",
|
|
266317
|
+
description: "Local source repository"
|
|
266318
|
+
};
|
|
266319
|
+
}
|
|
266320
|
+
case "npm":
|
|
266321
|
+
default: {
|
|
266322
|
+
return {
|
|
266323
|
+
command: "npm install -g @trydecember/cli@latest",
|
|
266324
|
+
manualCmd: "npm install -g @trydecember/cli@latest",
|
|
266325
|
+
description: "NPM global package"
|
|
266326
|
+
};
|
|
266327
|
+
}
|
|
266328
|
+
}
|
|
266329
|
+
}
|
|
266330
|
+
async function performCliUpdate(options) {
|
|
266331
|
+
let configInstallMethod = options?.configInstallMethod;
|
|
266332
|
+
if (!configInstallMethod) {
|
|
266333
|
+
try {
|
|
266334
|
+
const config3 = await loadConfig();
|
|
266335
|
+
configInstallMethod = config3.installMethod;
|
|
266336
|
+
} catch {}
|
|
266337
|
+
}
|
|
266338
|
+
const platform4 = options?.platform ?? process.platform;
|
|
266339
|
+
const method2 = detectInstallMethod({ configInstallMethod });
|
|
266340
|
+
const { command, manualCmd, description } = getUpdateCommand(method2, platform4);
|
|
266341
|
+
if (method2 === "source") {
|
|
266342
|
+
const msg = "Running December CLI from local source development directory.";
|
|
266343
|
+
options?.onProgress?.(msg);
|
|
266344
|
+
return {
|
|
266345
|
+
success: true,
|
|
266346
|
+
method: "source",
|
|
266347
|
+
command,
|
|
266348
|
+
manualCmd,
|
|
266349
|
+
output: msg
|
|
266350
|
+
};
|
|
266351
|
+
}
|
|
266352
|
+
options?.onProgress?.(`Updating December CLI via ${description}...`);
|
|
266353
|
+
const execCommand = options?.execFn ?? exec5;
|
|
266354
|
+
return new Promise((resolve4) => {
|
|
266355
|
+
execCommand(command, { timeout: 120000 }, async (error6, stdout, stderr) => {
|
|
266356
|
+
if (error6) {
|
|
266357
|
+
const errMessage = (stderr || error6.message || "Unknown update failure").trim();
|
|
266358
|
+
options?.onError?.(errMessage, manualCmd);
|
|
266359
|
+
resolve4({
|
|
266360
|
+
success: false,
|
|
266361
|
+
method: method2,
|
|
266362
|
+
command,
|
|
266363
|
+
manualCmd,
|
|
266364
|
+
error: errMessage
|
|
266365
|
+
});
|
|
266366
|
+
return;
|
|
266367
|
+
}
|
|
266368
|
+
try {
|
|
266369
|
+
await clearVersionCheckCache();
|
|
266370
|
+
} catch {}
|
|
266371
|
+
if (options?.onSuccess) {
|
|
266372
|
+
try {
|
|
266373
|
+
await options.onSuccess();
|
|
266374
|
+
} catch {}
|
|
266375
|
+
}
|
|
266376
|
+
resolve4({
|
|
266377
|
+
success: true,
|
|
266378
|
+
method: method2,
|
|
266379
|
+
command,
|
|
266380
|
+
manualCmd,
|
|
266381
|
+
output: (stdout || "Update completed successfully.").trim()
|
|
266382
|
+
});
|
|
266383
|
+
});
|
|
266384
|
+
});
|
|
266385
|
+
}
|
|
266386
|
+
var init_updater = __esm(() => {
|
|
266387
|
+
init_config();
|
|
266388
|
+
init_version_check();
|
|
266389
|
+
});
|
|
266390
|
+
|
|
266106
266391
|
// src/hooks/use-agent-session.ts
|
|
266107
266392
|
var exports_use_agent_session = {};
|
|
266108
266393
|
__export(exports_use_agent_session, {
|
|
@@ -266226,32 +266511,21 @@ function useAgentSession({
|
|
|
266226
266511
|
settingsFollowUpMode,
|
|
266227
266512
|
setSettingsFollowUpMode
|
|
266228
266513
|
} = state;
|
|
266229
|
-
const [expandCommands, setExpandCommands] =
|
|
266230
|
-
const toggleExpandCommands =
|
|
266514
|
+
const [expandCommands, setExpandCommands] = import_react60.useState(true);
|
|
266515
|
+
const toggleExpandCommands = import_react60.useCallback(() => {
|
|
266231
266516
|
setExpandCommands((prev2) => !prev2);
|
|
266232
266517
|
}, []);
|
|
266233
|
-
|
|
266234
|
-
|
|
266235
|
-
|
|
266236
|
-
|
|
266237
|
-
|
|
266238
|
-
|
|
266239
|
-
|
|
266240
|
-
|
|
266241
|
-
|
|
266242
|
-
}, [
|
|
266243
|
-
|
|
266244
|
-
initialAuthMethod,
|
|
266245
|
-
initialHasBothAuth,
|
|
266246
|
-
initialSettingsAuthPriority,
|
|
266247
|
-
userEmail,
|
|
266248
|
-
setIsAuthenticated,
|
|
266249
|
-
setAuthMethod,
|
|
266250
|
-
setHasBothAuth,
|
|
266251
|
-
setSettingsAuthPriority,
|
|
266252
|
-
setCurrentEmail
|
|
266253
|
-
]);
|
|
266254
|
-
import_react58.useEffect(() => {
|
|
266518
|
+
import_react60.useEffect(() => {
|
|
266519
|
+
useCliStore.setState((prev2) => ({
|
|
266520
|
+
...prev2,
|
|
266521
|
+
isAuthenticated: initialAuth,
|
|
266522
|
+
authMethod: initialAuthMethod,
|
|
266523
|
+
hasBothAuth: initialHasBothAuth !== undefined ? initialHasBothAuth : prev2.hasBothAuth,
|
|
266524
|
+
settingsAuthPriority: initialSettingsAuthPriority !== undefined ? initialSettingsAuthPriority : prev2.settingsAuthPriority,
|
|
266525
|
+
currentEmail: userEmail !== undefined ? userEmail : prev2.currentEmail
|
|
266526
|
+
}));
|
|
266527
|
+
}, [initialAuth, initialAuthMethod, initialHasBothAuth, initialSettingsAuthPriority, userEmail]);
|
|
266528
|
+
import_react60.useEffect(() => {
|
|
266255
266529
|
if (agent2) {
|
|
266256
266530
|
setupAgentInterceptors(agent2, {
|
|
266257
266531
|
setAuthMode,
|
|
@@ -266260,8 +266534,8 @@ function useAgentSession({
|
|
|
266260
266534
|
});
|
|
266261
266535
|
}
|
|
266262
266536
|
}, [agent2, setAuthMode, setPendingQuestions, setPendingToolCall]);
|
|
266263
|
-
const activeShellAbortRef =
|
|
266264
|
-
|
|
266537
|
+
const activeShellAbortRef = import_react60.useRef(null);
|
|
266538
|
+
import_react60.useEffect(() => {
|
|
266265
266539
|
if (authMode === "tasks_mode") {
|
|
266266
266540
|
const update3 = () => {
|
|
266267
266541
|
setTasksData([...taskManager.getTasks()]);
|
|
@@ -266271,7 +266545,7 @@ function useAgentSession({
|
|
|
266271
266545
|
return () => clearInterval(interval);
|
|
266272
266546
|
}
|
|
266273
266547
|
}, [authMode, setTasksData]);
|
|
266274
|
-
|
|
266548
|
+
import_react60.useEffect(() => {
|
|
266275
266549
|
if (selectedProvider === "openrouter" || authMode === "model_select") {
|
|
266276
266550
|
loadConfig().then((config3) => {
|
|
266277
266551
|
if (config3.activeProvider === "openrouter" || selectedProvider === "openrouter") {
|
|
@@ -266283,11 +266557,11 @@ function useAgentSession({
|
|
|
266283
266557
|
});
|
|
266284
266558
|
}
|
|
266285
266559
|
}, [authMode, selectedProvider, setOpenRouterModels]);
|
|
266286
|
-
const handleKillTask =
|
|
266560
|
+
const handleKillTask = import_react60.useCallback((taskId) => {
|
|
266287
266561
|
taskManager.killTask(taskId);
|
|
266288
266562
|
setTasksData([...taskManager.getTasks()]);
|
|
266289
266563
|
}, [setTasksData]);
|
|
266290
|
-
const generateGrillQuestions =
|
|
266564
|
+
const generateGrillQuestions = import_react60.useCallback(async (userPrompt) => {
|
|
266291
266565
|
const trimmedPrompt = userPrompt.trim();
|
|
266292
266566
|
const displayPrompt = trimmedPrompt.startsWith("/") ? trimmedPrompt : `/grill ${trimmedPrompt}`;
|
|
266293
266567
|
if (!isAuthenticated) {
|
|
@@ -266409,7 +266683,7 @@ function useAgentSession({
|
|
|
266409
266683
|
setIsStreaming,
|
|
266410
266684
|
setStaticMessages
|
|
266411
266685
|
]);
|
|
266412
|
-
const generatePlanFromGrill =
|
|
266686
|
+
const generatePlanFromGrill = import_react60.useCallback(async (answers) => {
|
|
266413
266687
|
setAuthMode("none");
|
|
266414
266688
|
const originalPrompt = grillPrompt;
|
|
266415
266689
|
setGrillPrompt(null);
|
|
@@ -266490,7 +266764,7 @@ function useAgentSession({
|
|
|
266490
266764
|
setIsStreaming,
|
|
266491
266765
|
setStaticMessages
|
|
266492
266766
|
]);
|
|
266493
|
-
const handleGrillSelect =
|
|
266767
|
+
const handleGrillSelect = import_react60.useCallback(async (item) => {
|
|
266494
266768
|
if (item.value === "custom") {
|
|
266495
266769
|
setCustomInputMode(true);
|
|
266496
266770
|
return;
|
|
@@ -266511,7 +266785,7 @@ function useAgentSession({
|
|
|
266511
266785
|
setCustomInputMode,
|
|
266512
266786
|
setGrillAnswers
|
|
266513
266787
|
]);
|
|
266514
|
-
const handleSubmit =
|
|
266788
|
+
const handleSubmit = import_react60.useCallback(async (text3) => {
|
|
266515
266789
|
if (text3.trim() === "/exit") {
|
|
266516
266790
|
setShouldExit(true);
|
|
266517
266791
|
process.exit(0);
|
|
@@ -266730,6 +267004,25 @@ Explain which files need to be created, modified, or deleted, and what the chang
|
|
|
266730
267004
|
addToast("Initialized December workspace successfully!", "success");
|
|
266731
267005
|
return;
|
|
266732
267006
|
}
|
|
267007
|
+
if (text3.trim() === "/update") {
|
|
267008
|
+
const { performCliUpdate: performCliUpdate2 } = await Promise.resolve().then(() => (init_updater(), exports_updater));
|
|
267009
|
+
const result2 = await performCliUpdate2({
|
|
267010
|
+
onProgress: (msg) => addToast(msg, "info"),
|
|
267011
|
+
onSuccess: async () => {
|
|
267012
|
+
if (agent2) {
|
|
267013
|
+
await agent2.saveContext().catch(() => {});
|
|
267014
|
+
}
|
|
267015
|
+
}
|
|
267016
|
+
});
|
|
267017
|
+
if (result2.method === "source") {
|
|
267018
|
+
addToast('Running December CLI from local source. Run "git pull && bun install" to update.', "info");
|
|
267019
|
+
} else if (result2.success) {
|
|
267020
|
+
addToast(`December CLI updated successfully via ${result2.method}! Please restart the CLI in your terminal.`, "success");
|
|
267021
|
+
} else {
|
|
267022
|
+
addToast(`Update failed (${result2.method}): ${result2.error || "Unknown error"}. Try running: ${result2.manualCmd}`, "error");
|
|
267023
|
+
}
|
|
267024
|
+
return;
|
|
267025
|
+
}
|
|
266733
267026
|
if (text3.trim() === "/context") {
|
|
266734
267027
|
setAuthMode("context_select");
|
|
266735
267028
|
return;
|
|
@@ -266991,7 +267284,7 @@ If it doesn't open automatically, please click here:
|
|
|
266991
267284
|
authMethod,
|
|
266992
267285
|
selectedProvider
|
|
266993
267286
|
]);
|
|
266994
|
-
const handleAbort =
|
|
267287
|
+
const handleAbort = import_react60.useCallback(() => {
|
|
266995
267288
|
if (activeShellAbortRef.current) {
|
|
266996
267289
|
activeShellAbortRef.current();
|
|
266997
267290
|
activeShellAbortRef.current = null;
|
|
@@ -267018,7 +267311,7 @@ If it doesn't open automatically, please click here:
|
|
|
267018
267311
|
handleOllamaCancel,
|
|
267019
267312
|
handleOllamaProceed
|
|
267020
267313
|
} = useAuthHandlers(agent2, onLogin, onLoginHeadless);
|
|
267021
|
-
const handlePlanApprovalSelect =
|
|
267314
|
+
const handlePlanApprovalSelect = import_react60.useCallback(async (item) => {
|
|
267022
267315
|
setAuthMode("none");
|
|
267023
267316
|
const originalPrompt = currentPlannedPrompt;
|
|
267024
267317
|
setCurrentPlannedPrompt(null);
|
|
@@ -267179,7 +267472,7 @@ If it doesn't open automatically, please click here:
|
|
|
267179
267472
|
handleReloadMcp
|
|
267180
267473
|
};
|
|
267181
267474
|
}
|
|
267182
|
-
var
|
|
267475
|
+
var import_react60;
|
|
267183
267476
|
var init_use_agent_session = __esm(async () => {
|
|
267184
267477
|
init_src5();
|
|
267185
267478
|
init_src();
|
|
@@ -267198,7 +267491,7 @@ var init_use_agent_session = __esm(async () => {
|
|
|
267198
267491
|
init_use_auth_handlers(),
|
|
267199
267492
|
init_use_settings_handlers()
|
|
267200
267493
|
]);
|
|
267201
|
-
|
|
267494
|
+
import_react60 = __toESM(require_react(), 1);
|
|
267202
267495
|
});
|
|
267203
267496
|
|
|
267204
267497
|
// src/local-operations.ts
|
|
@@ -267210,15 +267503,15 @@ __export(exports_local_operations, {
|
|
|
267210
267503
|
setActiveScopeDir: () => setActiveScopeDir
|
|
267211
267504
|
});
|
|
267212
267505
|
import { exec as exec6, spawn as spawn6 } from "node:child_process";
|
|
267213
|
-
import
|
|
267214
|
-
import
|
|
267506
|
+
import fs21 from "node:fs/promises";
|
|
267507
|
+
import path20 from "node:path";
|
|
267215
267508
|
import { promisify as promisify4 } from "node:util";
|
|
267216
267509
|
function setActiveScopeDir(dir) {
|
|
267217
267510
|
activeScopeDir = dir;
|
|
267218
267511
|
}
|
|
267219
267512
|
function getScopedCwd() {
|
|
267220
267513
|
if (activeScopeDir) {
|
|
267221
|
-
return
|
|
267514
|
+
return path20.resolve(process.cwd(), activeScopeDir);
|
|
267222
267515
|
}
|
|
267223
267516
|
return process.cwd();
|
|
267224
267517
|
}
|
|
@@ -267316,19 +267609,19 @@ Failed to start process: ${err?.message || err}
|
|
|
267316
267609
|
fs: {
|
|
267317
267610
|
readFile: async (filepath) => {
|
|
267318
267611
|
const root2 = getScopedCwd();
|
|
267319
|
-
const absolutePath =
|
|
267320
|
-
return
|
|
267612
|
+
const absolutePath = path20.isAbsolute(filepath) ? filepath : path20.resolve(root2, filepath);
|
|
267613
|
+
return fs21.readFile(absolutePath, "utf8");
|
|
267321
267614
|
},
|
|
267322
267615
|
writeFile: async (filepath, content) => {
|
|
267323
267616
|
const root2 = getScopedCwd();
|
|
267324
|
-
const absolutePath =
|
|
267325
|
-
await
|
|
267326
|
-
await
|
|
267617
|
+
const absolutePath = path20.isAbsolute(filepath) ? filepath : path20.resolve(root2, filepath);
|
|
267618
|
+
await fs21.mkdir(path20.dirname(absolutePath), { recursive: true });
|
|
267619
|
+
await fs21.writeFile(absolutePath, content, "utf8");
|
|
267327
267620
|
},
|
|
267328
267621
|
readdir: async (dirPath) => {
|
|
267329
267622
|
const root2 = getScopedCwd();
|
|
267330
|
-
const absolutePath =
|
|
267331
|
-
const entries = await
|
|
267623
|
+
const absolutePath = path20.isAbsolute(dirPath) ? dirPath : path20.resolve(root2, dirPath);
|
|
267624
|
+
const entries = await fs21.readdir(absolutePath, { withFileTypes: true });
|
|
267332
267625
|
const ignores = getWorkspaceIgnores(root2);
|
|
267333
267626
|
return entries.filter((entry) => !isPathIgnored(entry.name, ignores)).map((entry) => {
|
|
267334
267627
|
const type4 = entry.isDirectory() ? "DIR " : "FILE";
|
|
@@ -267337,14 +267630,14 @@ Failed to start process: ${err?.message || err}
|
|
|
267337
267630
|
},
|
|
267338
267631
|
mkdir: async (dirPath, options) => {
|
|
267339
267632
|
const root2 = getScopedCwd();
|
|
267340
|
-
const absolutePath =
|
|
267341
|
-
await
|
|
267633
|
+
const absolutePath = path20.isAbsolute(dirPath) ? dirPath : path20.resolve(root2, dirPath);
|
|
267634
|
+
await fs21.mkdir(absolutePath, options);
|
|
267342
267635
|
},
|
|
267343
267636
|
exists: async (filepath) => {
|
|
267344
267637
|
const root2 = getScopedCwd();
|
|
267345
|
-
const absolutePath =
|
|
267638
|
+
const absolutePath = path20.isAbsolute(filepath) ? filepath : path20.resolve(root2, filepath);
|
|
267346
267639
|
try {
|
|
267347
|
-
await
|
|
267640
|
+
await fs21.access(absolutePath);
|
|
267348
267641
|
return true;
|
|
267349
267642
|
} catch {
|
|
267350
267643
|
return false;
|
|
@@ -267354,7 +267647,7 @@ Failed to start process: ${err?.message || err}
|
|
|
267354
267647
|
search: {
|
|
267355
267648
|
find: async (dirPath, query3) => {
|
|
267356
267649
|
const root2 = getScopedCwd();
|
|
267357
|
-
const targetDir =
|
|
267650
|
+
const targetDir = path20.isAbsolute(dirPath) ? dirPath : path20.resolve(root2, dirPath);
|
|
267358
267651
|
const ignores = getWorkspaceIgnores(root2);
|
|
267359
267652
|
const files = await import_fast_glob2.default([query3], {
|
|
267360
267653
|
cwd: targetDir,
|
|
@@ -267366,7 +267659,7 @@ Failed to start process: ${err?.message || err}
|
|
|
267366
267659
|
},
|
|
267367
267660
|
grep: async (dirPath, query3) => {
|
|
267368
267661
|
const root2 = getScopedCwd();
|
|
267369
|
-
const targetDir =
|
|
267662
|
+
const targetDir = path20.isAbsolute(dirPath) ? dirPath : path20.resolve(root2, dirPath);
|
|
267370
267663
|
const ignores = getWorkspaceIgnores(root2);
|
|
267371
267664
|
try {
|
|
267372
267665
|
const cmd = `git grep -nI "${query3}" ${targetDir} || grep -rnI --exclude-dir=node_modules --exclude-dir=.git "${query3}" ${targetDir}`;
|
|
@@ -267424,110 +267717,12 @@ Failed to start process: ${err?.message || err}
|
|
|
267424
267717
|
};
|
|
267425
267718
|
});
|
|
267426
267719
|
|
|
267427
|
-
// src/utils/version-check.ts
|
|
267428
|
-
var exports_version_check = {};
|
|
267429
|
-
__export(exports_version_check, {
|
|
267430
|
-
CHECK_TTL_MS: () => CHECK_TTL_MS,
|
|
267431
|
-
checkForLatestVersion: () => checkForLatestVersion,
|
|
267432
|
-
clearVersionCheckCache: () => clearVersionCheckCache,
|
|
267433
|
-
isNewerVersion: () => isNewerVersion
|
|
267434
|
-
});
|
|
267435
|
-
import https2 from "node:https";
|
|
267436
|
-
function isNewerVersion(current, latest) {
|
|
267437
|
-
const cleanCurrent = current.replace(/^v/, "");
|
|
267438
|
-
const cleanLatest = latest.replace(/^v/, "");
|
|
267439
|
-
const p1 = cleanCurrent.split(".").map((n) => Number(n) || 0);
|
|
267440
|
-
const p2 = cleanLatest.split(".").map((n) => Number(n) || 0);
|
|
267441
|
-
for (let i2 = 0;i2 < Math.max(p1.length, p2.length); i2++) {
|
|
267442
|
-
const v1 = p1[i2] ?? 0;
|
|
267443
|
-
const v2 = p2[i2] ?? 0;
|
|
267444
|
-
if (v2 > v1)
|
|
267445
|
-
return true;
|
|
267446
|
-
if (v1 > v2)
|
|
267447
|
-
return false;
|
|
267448
|
-
}
|
|
267449
|
-
return false;
|
|
267450
|
-
}
|
|
267451
|
-
async function checkForLatestVersion(currentVersion) {
|
|
267452
|
-
try {
|
|
267453
|
-
const config3 = await loadConfig();
|
|
267454
|
-
const now2 = Date.now();
|
|
267455
|
-
if (config3.versionCheckCache) {
|
|
267456
|
-
const { latestVersion, checkedAt } = config3.versionCheckCache;
|
|
267457
|
-
if (now2 - checkedAt < CHECK_TTL_MS) {
|
|
267458
|
-
if (latestVersion && isNewerVersion(currentVersion, latestVersion)) {
|
|
267459
|
-
return latestVersion;
|
|
267460
|
-
}
|
|
267461
|
-
return null;
|
|
267462
|
-
}
|
|
267463
|
-
}
|
|
267464
|
-
const freshLatest = await fetchLatestFromNpm();
|
|
267465
|
-
if (freshLatest) {
|
|
267466
|
-
config3.versionCheckCache = {
|
|
267467
|
-
latestVersion: freshLatest,
|
|
267468
|
-
checkedAt: now2
|
|
267469
|
-
};
|
|
267470
|
-
await saveConfig(config3).catch(() => {});
|
|
267471
|
-
if (isNewerVersion(currentVersion, freshLatest)) {
|
|
267472
|
-
return freshLatest;
|
|
267473
|
-
}
|
|
267474
|
-
}
|
|
267475
|
-
} catch {}
|
|
267476
|
-
return null;
|
|
267477
|
-
}
|
|
267478
|
-
function fetchLatestFromNpm() {
|
|
267479
|
-
return new Promise((resolve4) => {
|
|
267480
|
-
const req = https2.get("https://registry.npmjs.org/@trydecember/cli/latest", { timeout: 1200 }, (res) => {
|
|
267481
|
-
if (res.statusCode !== 200) {
|
|
267482
|
-
resolve4(null);
|
|
267483
|
-
return;
|
|
267484
|
-
}
|
|
267485
|
-
let data2 = "";
|
|
267486
|
-
res.on("data", (chunk2) => {
|
|
267487
|
-
data2 += chunk2;
|
|
267488
|
-
});
|
|
267489
|
-
res.on("end", () => {
|
|
267490
|
-
try {
|
|
267491
|
-
const parsed = JSON.parse(data2);
|
|
267492
|
-
const latest = parsed.version;
|
|
267493
|
-
if (latest && typeof latest === "string") {
|
|
267494
|
-
resolve4(latest);
|
|
267495
|
-
} else {
|
|
267496
|
-
resolve4(null);
|
|
267497
|
-
}
|
|
267498
|
-
} catch {
|
|
267499
|
-
resolve4(null);
|
|
267500
|
-
}
|
|
267501
|
-
});
|
|
267502
|
-
});
|
|
267503
|
-
req.on("error", () => resolve4(null));
|
|
267504
|
-
req.on("timeout", () => {
|
|
267505
|
-
req.destroy();
|
|
267506
|
-
resolve4(null);
|
|
267507
|
-
});
|
|
267508
|
-
});
|
|
267509
|
-
}
|
|
267510
|
-
async function clearVersionCheckCache() {
|
|
267511
|
-
try {
|
|
267512
|
-
const config3 = await loadConfig();
|
|
267513
|
-
if (config3.versionCheckCache) {
|
|
267514
|
-
delete config3.versionCheckCache;
|
|
267515
|
-
await saveConfig(config3);
|
|
267516
|
-
}
|
|
267517
|
-
} catch {}
|
|
267518
|
-
}
|
|
267519
|
-
var CHECK_TTL_MS;
|
|
267520
|
-
var init_version_check = __esm(() => {
|
|
267521
|
-
init_config();
|
|
267522
|
-
CHECK_TTL_MS = 24 * 60 * 60 * 1000;
|
|
267523
|
-
});
|
|
267524
|
-
|
|
267525
267720
|
// src/index.ts
|
|
267526
|
-
import
|
|
267721
|
+
import path21 from "node:path";
|
|
267527
267722
|
// package.json
|
|
267528
267723
|
var package_default = {
|
|
267529
267724
|
name: "@trydecember/cli",
|
|
267530
|
-
version: "0.3.
|
|
267725
|
+
version: "0.3.14",
|
|
267531
267726
|
description: "AI coding agent for terminal and cloud.",
|
|
267532
267727
|
homepage: "https://trydecember.com",
|
|
267533
267728
|
repository: {
|
|
@@ -267761,7 +267956,7 @@ Waiting for authorization...`);
|
|
|
267761
267956
|
if (parsedArgs.scope) {
|
|
267762
267957
|
setActiveScopeDir2(parsedArgs.scope);
|
|
267763
267958
|
}
|
|
267764
|
-
const
|
|
267959
|
+
const React32 = reactModule.default || reactModule;
|
|
267765
267960
|
const { render: render4 } = inkModule;
|
|
267766
267961
|
const { ChatApp: App2, RootLayout: RootLayout2 } = tuiModule;
|
|
267767
267962
|
suppressConsole2();
|
|
@@ -267802,7 +267997,7 @@ Waiting for authorization...`);
|
|
|
267802
267997
|
},
|
|
267803
267998
|
sessionRepository,
|
|
267804
267999
|
sessionId: parsedArgs.sessionId || sessionId,
|
|
267805
|
-
workspaceDir: parsedArgs.scope ?
|
|
268000
|
+
workspaceDir: parsedArgs.scope ? path21.resolve(process.cwd(), parsedArgs.scope) : process.cwd(),
|
|
267806
268001
|
hooks: {
|
|
267807
268002
|
beforeToolCall: async (toolCall) => {}
|
|
267808
268003
|
},
|
|
@@ -267829,8 +268024,8 @@ Executing Headless Task: "${parsedArgs.prompt}"
|
|
|
267829
268024
|
harness.initMCP().catch(() => {});
|
|
267830
268025
|
agent2.loadContext().catch((err) => {});
|
|
267831
268026
|
function AppWrapper(props) {
|
|
267832
|
-
const [latestVersion, setLatestVersion] =
|
|
267833
|
-
|
|
268027
|
+
const [latestVersion, setLatestVersion] = React32.useState(undefined);
|
|
268028
|
+
React32.useEffect(() => {
|
|
267834
268029
|
Promise.resolve().then(() => (init_version_check(), exports_version_check)).then(({ checkForLatestVersion: checkForLatestVersion2 }) => {
|
|
267835
268030
|
checkForLatestVersion2(package_default.version).then((v2) => {
|
|
267836
268031
|
if (v2)
|
|
@@ -267838,12 +268033,12 @@ Executing Headless Task: "${parsedArgs.prompt}"
|
|
|
267838
268033
|
});
|
|
267839
268034
|
}).catch(() => {});
|
|
267840
268035
|
}, []);
|
|
267841
|
-
const handleUpdateSuccess =
|
|
268036
|
+
const handleUpdateSuccess = React32.useCallback(async () => {
|
|
267842
268037
|
const { clearVersionCheckCache: clearVersionCheckCache2 } = await Promise.resolve().then(() => (init_version_check(), exports_version_check));
|
|
267843
268038
|
await clearVersionCheckCache2();
|
|
267844
268039
|
}, []);
|
|
267845
268040
|
const session = useAgentSession2(props);
|
|
267846
|
-
return
|
|
268041
|
+
return React32.createElement(App2, {
|
|
267847
268042
|
...props,
|
|
267848
268043
|
latestVersion,
|
|
267849
268044
|
onUpdateSuccess: handleUpdateSuccess,
|
|
@@ -267851,7 +268046,7 @@ Executing Headless Task: "${parsedArgs.prompt}"
|
|
|
267851
268046
|
});
|
|
267852
268047
|
}
|
|
267853
268048
|
const userEmail = config3.decemberToken ? config3.email : undefined;
|
|
267854
|
-
render4(
|
|
268049
|
+
render4(React32.createElement(RootLayout2, null, React32.createElement(AppWrapper, {
|
|
267855
268050
|
agent: agent2,
|
|
267856
268051
|
isAuthenticated,
|
|
267857
268052
|
authMethod: providerConfig?.authMethod,
|