nanocode-cli 0.2.3__tar.gz → 0.2.5__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nanocode-cli
3
- Version: 0.2.3
3
+ Version: 0.2.5
4
4
  Summary: A lightweight terminal-based AI coding assistant
5
5
  Author-email: hit9 <hit9@icloud.com>
6
6
  License-Expression: BSD-3-Clause
@@ -41,7 +41,7 @@ from prompt_toolkit.patch_stdout import patch_stdout
41
41
 
42
42
  JsonValue: TypeAlias = Any
43
43
  Json: TypeAlias = dict[str, JsonValue]
44
- __version__ = "0.2.3"
44
+ __version__ = "0.2.5"
45
45
 
46
46
 
47
47
  class Error(Exception): ...
@@ -1704,7 +1704,7 @@ Core:
1704
1704
  - Follow the plan, but revise it when facts require it.
1705
1705
 
1706
1706
  Tools:
1707
- - Call tools only by emitting JSON in tool_calls. Do not use native tool calls.
1707
+ - MUST use JSON tool_calls. Do not use native <tool_call>Tool(args...) syntax.
1708
1708
  - Use multiple tool calls in one turn when they are independent.
1709
1709
  - Prefer specific tools first; use Bash only when no provided tool fits.
1710
1710
  - Prefer Search before Read when locating code or facts; Read only known small ranges or exact files needed for editing.
@@ -1729,12 +1729,15 @@ Input:
1729
1729
  - Current_Context: task-local facts that may expire
1730
1730
  - Goal: current objective
1731
1731
  - Plan: ordered plan
1732
+ - Agent_Feedback: latest retry/gate warning for you; follow it before continuing
1732
1733
  - Latest_Tool_Call_Results: latest raw tool call results
1733
1734
  - Latest_User_Input: latest user message
1734
1735
  - Tools: available tool specs
1735
1736
 
1736
- Output strict JSON only. No markdown. No comments. No extra text.
1737
- Never answer outside JSON, including help/status/explanation requests; put user-facing text only in message_to_user.
1737
+ Output MUST be exactly one JSON object.
1738
+ No markdown, prose, code fences, XML tags, native tool calls, or text outside JSON.
1739
+ Put normal replies in message_to_user.
1740
+ Put tool calls only in JSON tool_calls.
1738
1741
 
1739
1742
  Schema:
1740
1743
  {
@@ -1834,6 +1837,10 @@ MAIN_AGENT_USER_PROMPT_TEMPLATE = """
1834
1837
  {verification_state}
1835
1838
  -------- Verification_State End -----------
1836
1839
 
1840
+ ----------- Agent_Feedback Begin ------
1841
+ {agent_feedback}
1842
+ -------- Agent_Feedback End -----------
1843
+
1837
1844
  ----------- Latest_Tool_Call_Results Begin ------
1838
1845
  {latest_tool_call_results}
1839
1846
  -------- Latest_Tool_Call_Results End -----------
@@ -1888,7 +1895,7 @@ class PromptBuilder:
1888
1895
  def system_prompt(self) -> str:
1889
1896
  return MAIN_AGENT_SYSTEM_PROMPT.replace("{ __tools__ }", self._format_tools()).strip()
1890
1897
 
1891
- def user_prompt(self, latest_tool_call_results: str) -> str:
1898
+ def user_prompt(self, latest_tool_call_results: str, agent_feedback: str) -> str:
1892
1899
  current = self.session.current
1893
1900
  return MAIN_AGENT_USER_PROMPT_TEMPLATE.format(
1894
1901
  environment=self._format_environment(),
@@ -1898,6 +1905,7 @@ class PromptBuilder:
1898
1905
  goal=current.goal or "(empty)",
1899
1906
  plan=self._format_plan(),
1900
1907
  verification_state=current.verification.format(),
1908
+ agent_feedback=agent_feedback or "(empty)",
1901
1909
  latest_tool_call_results=latest_tool_call_results or "(empty)",
1902
1910
  latest_user_input=current.user_input or "(empty)",
1903
1911
  ).strip()
@@ -2678,6 +2686,7 @@ class Agent:
2678
2686
  self.state_updater = AgentStateUpdater(session, self.tool_runner)
2679
2687
  self.compactor = ConversationCompactor(session, self.model_client)
2680
2688
  self.latest_tool_call_results = ""
2689
+ self.latest_agent_feedback = ""
2681
2690
 
2682
2691
  @property
2683
2692
  def latest_tool_call_events(self) -> list[ToolCallEvent]:
@@ -2687,9 +2696,10 @@ class Agent:
2687
2696
  return self.prompt_builder.system_prompt()
2688
2697
 
2689
2698
  def build_user_prompt(self, *, consume_latest_tool_results: bool = True) -> str:
2690
- prompt = self.prompt_builder.user_prompt(self.latest_tool_call_results)
2699
+ prompt = self.prompt_builder.user_prompt(self.latest_tool_call_results, self.latest_agent_feedback)
2691
2700
  if consume_latest_tool_results:
2692
2701
  self.latest_tool_call_results = ""
2702
+ self.latest_agent_feedback = ""
2693
2703
  return prompt
2694
2704
 
2695
2705
  def request(self, system_prompt: str, user_prompt: str, *, activity: str = "main") -> Json:
@@ -2710,6 +2720,7 @@ class Agent:
2710
2720
  on_message: MessageCallback | None = None,
2711
2721
  ) -> Json:
2712
2722
  self.latest_tool_call_results = ""
2723
+ self.latest_agent_feedback = ""
2713
2724
  self.session.current.user_input = user_input
2714
2725
  self.session.current.goal_reached = False
2715
2726
  self.maybe_auto_compact()
@@ -2721,7 +2732,7 @@ class Agent:
2721
2732
  format_error = _json_str(response.get("_format_error"))
2722
2733
  if format_error:
2723
2734
  consecutive_format_errors += 1
2724
- self.latest_tool_call_results = format_error
2735
+ self.latest_agent_feedback = format_error
2725
2736
  if consecutive_format_errors >= self.MAX_CONSECUTIVE_FORMAT_ERRORS:
2726
2737
  self._report_gate(
2727
2738
  on_message,
@@ -2747,16 +2758,6 @@ class Agent:
2747
2758
  continue
2748
2759
  consecutive_format_errors = 0
2749
2760
  tool_calls = _json_list(response.get("tool_calls"))
2750
- summary_gate = self._format_tool_summary_gate(tool_calls)
2751
- if summary_gate:
2752
- self.state_updater.latest_report = ""
2753
- self.latest_tool_call_results = summary_gate
2754
- self._report_gate(
2755
- on_message,
2756
- "Retrying: model needs to summarize the latest tool results.",
2757
- self._compact_gate_report(summary_gate),
2758
- )
2759
- continue
2760
2761
  self.apply_response(response)
2761
2762
  if on_message is not None and self.state_updater.latest_report:
2762
2763
  on_message(self.state_updater.latest_report)
@@ -2777,7 +2778,7 @@ class Agent:
2777
2778
  return response
2778
2779
  if self.session.current.verification.status == VerificationStatus.REQUIRED:
2779
2780
  self.session.current.goal_reached = False
2780
- self.latest_tool_call_results = self._format_verification_gate()
2781
+ self.latest_agent_feedback = self._format_verification_gate()
2781
2782
  self._report_gate(
2782
2783
  on_message,
2783
2784
  "Retrying: verification is required before completion.",
@@ -2785,7 +2786,7 @@ class Agent:
2785
2786
  )
2786
2787
  continue
2787
2788
  if not self.session.current.goal_reached:
2788
- self.latest_tool_call_results = self._format_continuation_hint()
2789
+ self.latest_agent_feedback = self._format_continuation_hint()
2789
2790
  self._report_gate(
2790
2791
  on_message,
2791
2792
  "Continuing: goal is not complete yet.",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nanocode-cli
3
- Version: 0.2.3
3
+ Version: 0.2.5
4
4
  Summary: A lightweight terminal-based AI coding assistant
5
5
  Author-email: hit9 <hit9@icloud.com>
6
6
  License-Expression: BSD-3-Clause
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "nanocode-cli"
7
- version = "0.2.3"
7
+ version = "0.2.5"
8
8
  description = "A lightweight terminal-based AI coding assistant"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
File without changes
File without changes
File without changes
File without changes