dskcode 0.1.34 → 0.1.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2101,7 +2101,7 @@ function TodoListPanel({ items }) {
2101
2101
  // package.json
2102
2102
  var package_default = {
2103
2103
  name: "dskcode",
2104
- version: "0.1.34",
2104
+ version: "0.1.36",
2105
2105
  repository: {
2106
2106
  type: "git",
2107
2107
  url: "git+https://github.com/Awu12277/deepseek-agent-cli/tree/main"
@@ -3025,9 +3025,9 @@ var TodoList = class {
3025
3025
  (it) => it.status === "done" || it.status === "failed" || it.status === "skipped"
3026
3026
  );
3027
3027
  }
3028
- /** 全部条目(只读快照) */
3028
+ /** 全部条目(只读快照 — 每次返回新数组,避免上游拿到内部引用后被原地修改) */
3029
3029
  get items() {
3030
- return this.#items;
3030
+ return this.#items.map((it) => ({ ...it }));
3031
3031
  }
3032
3032
  /**
3033
3033
  * 把 todo 列表拼成 markdown,用于注入 system prompt。
@@ -6091,6 +6091,7 @@ function ChatSession({
6091
6091
  const [todoSnapshot, setTodoSnapshot] = useState4([]);
6092
6092
  const [todoPanelVisible, setTodoPanelVisible] = useState4(true);
6093
6093
  const todoHideTimerRef = useRef3(null);
6094
+ const lastDoneBatchMaxIdRef = useRef3(-1);
6094
6095
  const [sessionMode, setSessionMode] = useState4("code");
6095
6096
  const [thinkingEnabled, setThinkingEnabled] = useState4(true);
6096
6097
  const [thinkingEffort, setThinkingEffort] = useState4("high");
@@ -6160,7 +6161,15 @@ function ChatSession({
6160
6161
  const hasUnfinished = todoSnapshot.some(
6161
6162
  (it) => it.status === "pending" || it.status === "running" || it.status === "failed"
6162
6163
  );
6163
- setTodoPanelVisible(hasUnfinished);
6164
+ if (hasUnfinished) {
6165
+ setTodoPanelVisible(true);
6166
+ } else {
6167
+ lastDoneBatchMaxIdRef.current = Math.max(...todoSnapshot.map((it) => it.id));
6168
+ todoHideTimerRef.current = setTimeout(() => {
6169
+ setTodoPanelVisible(false);
6170
+ todoHideTimerRef.current = null;
6171
+ }, 2e3);
6172
+ }
6164
6173
  }, [todoSnapshot]);
6165
6174
  const getFilteredSkills = useCallback2(
6166
6175
  (value) => {
@@ -6746,6 +6755,7 @@ function ChatSession({
6746
6755
  setStreamError(void 0);
6747
6756
  process.stdout.write("\x1B[2J\x1B[H\x1B[3J");
6748
6757
  sessionRef.current?.reset();
6758
+ lastDoneBatchMaxIdRef.current = -1;
6749
6759
  return;
6750
6760
  case "navigate":
6751
6761
  setInput("");
@@ -6813,6 +6823,11 @@ function ChatSession({
6813
6823
  rewindHintTimerRef.current = null;
6814
6824
  }
6815
6825
  setTodoSnapshot([]);
6826
+ if (todoHideTimerRef.current) {
6827
+ clearTimeout(todoHideTimerRef.current);
6828
+ todoHideTimerRef.current = null;
6829
+ }
6830
+ setTodoPanelVisible(false);
6816
6831
  const session = sessionRef.current;
6817
6832
  const abortController = new AbortController();
6818
6833
  abortRef.current = abortController;
@@ -6870,13 +6885,19 @@ function ChatSession({
6870
6885
  currentToolCallsRef.current = [];
6871
6886
  const r = event.result;
6872
6887
  if (event.name.startsWith("todo_") && event.todoSnapshot) {
6873
- const allTerminated = event.todoSnapshot.length > 0 && event.todoSnapshot.every(
6888
+ const snapshot = [...event.todoSnapshot];
6889
+ const allTerminated = snapshot.length > 0 && snapshot.every(
6874
6890
  (it) => it.status === "done" || it.status === "failed" || it.status === "skipped"
6875
6891
  );
6876
6892
  if (allTerminated) {
6877
- setTodoSnapshot([]);
6893
+ lastDoneBatchMaxIdRef.current = Math.max(...snapshot.map((it) => it.id));
6894
+ setTodoSnapshot(snapshot);
6895
+ } else if (lastDoneBatchMaxIdRef.current >= 0) {
6896
+ setTodoSnapshot(
6897
+ snapshot.filter((it) => it.id > lastDoneBatchMaxIdRef.current)
6898
+ );
6878
6899
  } else {
6879
- setTodoSnapshot(event.todoSnapshot);
6900
+ setTodoSnapshot(snapshot);
6880
6901
  }
6881
6902
  } else {
6882
6903
  const line = r.success ? r.summary ?? `\u2705 ${event.name}: ${r.data.slice(0, 500)}${r.data.length > 500 ? "..." : ""}` : `\u274C ${event.name}: ${r.error ?? "\u6267\u884C\u5931\u8D25"}`;