zrb 1.10.0__py3-none-any.whl → 1.10.2__py3-none-any.whl

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.
zrb/__init__.py CHANGED
@@ -47,7 +47,7 @@ _LAZY_LOAD = {
47
47
  "BaseTrigger": "zrb.task.base_trigger",
48
48
  "CmdTask": "zrb.task.cmd_task",
49
49
  "HttpCheck": "zrb.task.http_check",
50
- "ConversationHistoryData": "zrb.task.llm.history",
50
+ "ConversationHistory": "zrb.task.llm.conversation_history",
51
51
  "LLMTask": "zrb.task.llm_task",
52
52
  "make_task": "zrb.task.make_task",
53
53
  "RsyncTask": "zrb.task.rsync_task",
@@ -107,7 +107,7 @@ if TYPE_CHECKING:
107
107
  from zrb.task.base_trigger import BaseTrigger
108
108
  from zrb.task.cmd_task import CmdTask
109
109
  from zrb.task.http_check import HttpCheck
110
- from zrb.task.llm.conversation_history import ConversationHistoryData
110
+ from zrb.task.llm.conversation_history import ConversationHistory
111
111
  from zrb.task.llm_task import LLMTask
112
112
  from zrb.task.make_task import make_task
113
113
  from zrb.task.rsync_task import RsyncTask
@@ -11,7 +11,7 @@ from zrb.util.file import read_file, write_file
11
11
  def read_chat_conversation(ctx: AnySharedContext) -> dict[str, Any] | list | None:
12
12
  """Reads conversation history from the session file.
13
13
  Returns the raw dictionary or list loaded from JSON, or None if not found/empty.
14
- The LLMTask will handle parsing this into ConversationHistoryData.
14
+ The LLMTask will handle parsing this into ConversationHistory.
15
15
  """
16
16
  if ctx.input.start_new:
17
17
  return None # Indicate no history to load
zrb/config/llm_config.py CHANGED
@@ -83,7 +83,7 @@ _DEFAULT_SYSTEM_PROMPT = (
83
83
  ).strip()
84
84
 
85
85
  _DEFAULT_SPECIAL_INSTRUCTION_PROMPT = (
86
- "## Guiding Principles\n"
86
+ "# Guiding Principles\n"
87
87
  "- **Clarify and Scope First:** Before undertaking any complex task (like "
88
88
  "writing a new feature or a large test suite), you MUST ensure the request "
89
89
  "is not ambiguous. If it is, ask clarifying questions. Propose a concise "
@@ -97,7 +97,7 @@ _DEFAULT_SPECIAL_INSTRUCTION_PROMPT = (
97
97
  "conventions.\n"
98
98
  "- **Efficiency:** Use your tools to get the job done with the minimum "
99
99
  "number of steps. Combine commands where possible.\n\n"
100
- "## Critical Prohibitions\n"
100
+ "# Critical Prohibitions\n"
101
101
  "- **NEVER Assume Dependencies:** Do not use a library or framework unless "
102
102
  "you have first verified it is an existing project dependency (e.g., in "
103
103
  "`package.json`, `requirements.txt`).\n"
@@ -108,7 +108,7 @@ _DEFAULT_SPECIAL_INSTRUCTION_PROMPT = (
108
108
  "- **NEVER Commit Without Verification:** Do not use `git commit` until you "
109
109
  "have staged the changes and run the project's own verification steps "
110
110
  "(tests, linter, build).\n\n"
111
- "## Common Task Workflows\n\n"
111
+ "# Common Task Workflows\n\n"
112
112
  "**File System Operations:**\n"
113
113
  "1. **Analyze:** Before modifying, read the file or list the "
114
114
  "directory.\n"
@@ -160,7 +160,7 @@ _DEFAULT_SPECIAL_INSTRUCTION_PROMPT = (
160
160
  "reputable sources.\n"
161
161
  "3. **Synthesize & Cite:** Present the information clearly. For factual "
162
162
  "claims, cite the source URL.\n\n"
163
- "## Communicating with the User\n"
163
+ "# Communicating with the User\n"
164
164
  "- **Be Concise:** When reporting results, be brief. Focus on the outcome "
165
165
  "and the verification step.\n"
166
166
  "- **Explain 'Why,' Not Just 'What':** For complex changes or bug fixes, "
@@ -187,7 +187,7 @@ _DEFAULT_SUMMARIZATION_PROMPT = (
187
187
  " - Identify any new, stable, and globally relevant information from "
188
188
  "the recent conversation. This includes user preferences, high-level "
189
189
  "goals, or facts that will be true regardless of the current working "
190
- "directory.\n"
190
+ "directory. Only extract facts.\n"
191
191
  " - If you find such information, use the `write_long_term_note` tool "
192
192
  "to save a concise, updated version of the note. Keep it brief and "
193
193
  "factual.\n\n"
@@ -195,7 +195,9 @@ _DEFAULT_SUMMARIZATION_PROMPT = (
195
195
  " - Read the existing `Contextual` note.\n"
196
196
  " - Identify new information relevant *only* to the current project "
197
197
  "or directory. This could be the file the user is working on, the "
198
- "specific bug they are fixing, or the feature they are building.\n"
198
+ "specific bug they are fixing, or the feature they are building. "
199
+ "This note might contain temporary context, and information should be "
200
+ "deleted once it is no longer relevant.\n"
199
201
  " - Use the `write_contextual_note` tool to save a concise, updated "
200
202
  "note about the current working context. This note should be focused on "
201
203
  "the immediate task at hand.\n\n"
@@ -81,9 +81,11 @@ class ConversationHistory:
81
81
  return None
82
82
 
83
83
  def fetch_newest_notes(self):
84
+ self.long_term_note = ""
84
85
  long_term_note_path = self._get_long_term_note_path()
85
86
  if os.path.isfile(long_term_note_path):
86
87
  self.long_term_note = read_file(long_term_note_path)
88
+ self.contextual_note = ""
87
89
  contextual_note_path = self._get_contextual_note_path()
88
90
  if os.path.isfile(contextual_note_path):
89
91
  self.contextual_note = read_file(contextual_note_path)
zrb/task/llm/prompt.py CHANGED
@@ -153,16 +153,30 @@ def extract_conversation_context(user_message: str) -> tuple[str, str]:
153
153
  modified_user_message = modified_user_message.replace(f"@{ref}", ref, 1)
154
154
  conversation_context = "\n".join(
155
155
  [
156
- make_prompt_section(
157
- "Current Time", datetime.now(timezone.utc).astimezone().isoformat()
158
- ),
159
- make_prompt_section("Current Working Directory", os.getcwd()),
160
156
  make_prompt_section("Current OS", platform.system()),
161
157
  make_prompt_section("OS Version", platform.version()),
162
158
  make_prompt_section("Python Version", platform.python_version()),
163
159
  make_prompt_section("Apendixes", "\n".join(apendixes)),
164
160
  ]
165
161
  )
162
+ iso_date = datetime.now(timezone.utc).astimezone().isoformat()
163
+ current_directory = os.getcwd()
164
+ modified_user_message = "\n".join(
165
+ [
166
+ make_prompt_section("User Message", modified_user_message),
167
+ make_prompt_section(
168
+ "Context",
169
+ "\n".join(
170
+ [
171
+ make_prompt_section(
172
+ "Current working directory", current_directory
173
+ ),
174
+ make_prompt_section("Current time", iso_date),
175
+ ]
176
+ ),
177
+ ),
178
+ ]
179
+ )
166
180
  return conversation_context, modified_user_message
167
181
 
168
182
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: zrb
3
- Version: 1.10.0
3
+ Version: 1.10.2
4
4
  Summary: Your Automation Powerhouse
5
5
  Home-page: https://github.com/state-alchemists/zrb
6
6
  License: AGPL-3.0-or-later
@@ -1,4 +1,4 @@
1
- zrb/__init__.py,sha256=W0Wz3UcnNf5oE-C0i5wkDWPISEktXv-ea-FCFO8zf2g,5114
1
+ zrb/__init__.py,sha256=GSVTmbO6guFI2oW5gGxQvn7ELOMa5-qPxfyQMv9H07M,5119
2
2
  zrb/__main__.py,sha256=9SXH9MK4PVyU9lkEyHxiIUABbcsV2wseP94HmlqTR4M,2657
3
3
  zrb/attr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  zrb/attr/type.py,sha256=4TV5gPYMMrKh5V-yB6iRYKCbsXAH_AvGXMsjxKLHcUs,568
@@ -10,7 +10,7 @@ zrb/builtin/group.py,sha256=t008xLM4_fgbjfZrPoi_fQAnSHIo6MOiQSCHBO4GDYU,2379
10
10
  zrb/builtin/http.py,sha256=sLqEczuSxGYXWzyJR6frGOHkPTviu4BeyroUr3-ZuAI,4322
11
11
  zrb/builtin/jwt.py,sha256=3M5uaQhJZbKQLjTUft1OwPz_JxtmK-xtkjxWjciOQho,2859
12
12
  zrb/builtin/llm/chat_session.py,sha256=0R04DpBr_LGfNJbXIQ_4XQSxL7kY2M3U-bbu5lsXZ54,8542
13
- zrb/builtin/llm/history.py,sha256=k4wY0anietrF5iEUVuYAAYGbhjs4TBo03goXzCk_pRM,3091
13
+ zrb/builtin/llm/history.py,sha256=LDOrL0p7r_AHLa5L8Dp7bHNsOALugmJd7OguXRWGnm4,3087
14
14
  zrb/builtin/llm/input.py,sha256=Nw-26uTWp2QhUgKJcP_IMHmtk-b542CCSQ_vCOjhvhM,877
15
15
  zrb/builtin/llm/llm_ask.py,sha256=oozfQwa1i2PnXV4qWbn60Pmd3fS0kgmhYCbfKlhr25o,4549
16
16
  zrb/builtin/llm/previous-session.js,sha256=xMKZvJoAbrwiyHS0OoPrWuaKxWYLoyR5sguePIoCjTY,816
@@ -218,7 +218,7 @@ zrb/cmd/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
218
218
  zrb/cmd/cmd_result.py,sha256=L8bQJzWCpcYexIxHBNsXj2pT3BtLmWex0iJSMkvimOA,597
219
219
  zrb/cmd/cmd_val.py,sha256=7Doowyg6BK3ISSGBLt-PmlhzaEkBjWWm51cED6fAUOQ,1014
220
220
  zrb/config/config.py,sha256=vUmJWQHRgmMVL1FmoukjQe9J6vCuyzqBIg4FncREGmw,15108
221
- zrb/config/llm_config.py,sha256=ROGDX3LKE5YI9JkhcMUO0E-ffscj716PAN4b7u1EFRY,20676
221
+ zrb/config/llm_config.py,sha256=2UO6a9DxN-WkZ6rwZX8hNEhK_UZjjDeCNCFvADbQaws,20814
222
222
  zrb/config/llm_rate_limitter.py,sha256=P4vR7qxwiGwjlKx2kHcfdIxwGbJB98vdN-UQEH-Q2WU,4894
223
223
  zrb/config/web_auth_config.py,sha256=_PXatQTYh2mX9H3HSYSQKp13zm1RlLyVIoeIr6KYMQ8,6279
224
224
  zrb/content_transformer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -340,11 +340,11 @@ zrb/task/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
340
340
  zrb/task/llm/agent.py,sha256=BZHbz-YXgSdm1tTwGMR_maqcd3yMFGSdzLyDjuxT_XI,6702
341
341
  zrb/task/llm/config.py,sha256=TlyH925_fboIlK2Ixf34tynmenqs9s9rfsnPs4jff78,3490
342
342
  zrb/task/llm/conversation_history.py,sha256=B_PDWYL_q66s0xwWBzMSomqPN6u3gkXlIeXBD5A0Apg,4416
343
- zrb/task/llm/conversation_history_model.py,sha256=Zbz7w0M2FeOklWG4AVz8C2y2AZ87aNMZ5I0YbBanO0Y,16312
343
+ zrb/task/llm/conversation_history_model.py,sha256=xsKo2QtAie_1f7rVIQ6ruaClv1NdkhLbK4Fa9WUGtnM,16379
344
344
  zrb/task/llm/error.py,sha256=QR-nIohS6pBpC_16cWR-fw7Mevo1sNYAiXMBsh_CJDE,4157
345
345
  zrb/task/llm/history_summarization.py,sha256=vY2_iLULgSNTaqW1xJqOhI8oOH3vNEsZn_yNcx6jYX8,8104
346
346
  zrb/task/llm/print_node.py,sha256=zocTKi9gZDxl2I6KNu095TmMc13Yip6SNuWYnswS680,4060
347
- zrb/task/llm/prompt.py,sha256=ARyJ2Q0G6N7I2X2KZfLQW45yj9nmzl5SfX90rrY7TVU,7417
347
+ zrb/task/llm/prompt.py,sha256=TZYoI5MXddhHYnlVNsIjRLdhGwA9eEBVSeGz_Wi31JQ,7833
348
348
  zrb/task/llm/tool_wrapper.py,sha256=8_bL8m_WpRf-pVKSrvQIVqT-m2sUA87a1RBQG13lhp4,6457
349
349
  zrb/task/llm/typing.py,sha256=c8VAuPBw_4A3DxfYdydkgedaP-LU61W9_wj3m3CAX1E,58
350
350
  zrb/task/llm_task.py,sha256=TTYb9FYqZX_OIgDE6q5Z9IVuM6NcsKFeCVIi6ovQDE8,13712
@@ -393,7 +393,7 @@ zrb/util/todo.py,sha256=r9_KYF2-hLKMNjsp6AFK9zivykMrywd-kJ4bCwfdafI,19323
393
393
  zrb/util/todo_model.py,sha256=hhzAX-uFl5rsg7iVX1ULlJOfBtblwQ_ieNUxBWfc-Os,1670
394
394
  zrb/xcom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
395
395
  zrb/xcom/xcom.py,sha256=o79rxR9wphnShrcIushA0Qt71d_p3ZTxjNf7x9hJB78,1571
396
- zrb-1.10.0.dist-info/METADATA,sha256=L0WbyLS9Ormz797L5aHD2ycfplf___3mDYqx05H_Eqs,9778
397
- zrb-1.10.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
398
- zrb-1.10.0.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
399
- zrb-1.10.0.dist-info/RECORD,,
396
+ zrb-1.10.2.dist-info/METADATA,sha256=0UVwKjfnakRF8kPcW_37rGPJ5sEZwCcEywEOrg5l_D4,9778
397
+ zrb-1.10.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
398
+ zrb-1.10.2.dist-info/entry_points.txt,sha256=-Pg3ElWPfnaSM-XvXqCxEAa-wfVI6BEgcs386s8C8v8,46
399
+ zrb-1.10.2.dist-info/RECORD,,
File without changes