statek 1.2.2__tar.gz → 1.2.4__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.
- {statek-1.2.2/statek.egg-info → statek-1.2.4}/PKG-INFO +1 -1
- {statek-1.2.2 → statek-1.2.4}/pyproject.toml +1 -1
- {statek-1.2.2 → statek-1.2.4}/statek/executors/job.py +9 -2
- {statek-1.2.2 → statek-1.2.4}/statek/executors/utils.py +25 -7
- {statek-1.2.2 → statek-1.2.4}/statek/llm_api.py +10 -9
- {statek-1.2.2 → statek-1.2.4/statek.egg-info}/PKG-INFO +1 -1
- {statek-1.2.2 → statek-1.2.4}/LICENSE +0 -0
- {statek-1.2.2 → statek-1.2.4}/MANIFEST.in +0 -0
- {statek-1.2.2 → statek-1.2.4}/NOTICE +0 -0
- {statek-1.2.2 → statek-1.2.4}/README.md +0 -0
- {statek-1.2.2 → statek-1.2.4}/THIRD_PARTY_NOTICES.md +0 -0
- {statek-1.2.2 → statek-1.2.4}/setup.cfg +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/__init__.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/agents/__init__.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/agents/agent.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/agents/coordinator.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/agents/dialog_agent.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/agents/list_of_documents.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/agents/list_of_examples.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/agents/message_dispatcher.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/agents/researcher.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/chat_history.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/chat_style.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/dbzero_restricted.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/docstring.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/document.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/exceptions.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/executors/chat_log_item.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/executors/example.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/executors/llm_usage.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/executors/post_processor.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/future.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/llm_harness.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/llm_tools_scope.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/locale.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/model_name.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/model_pricing.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/multi_source_settings.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/prompt_config.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/provider_config.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/pyenv.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/python_response_format.json +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/python_sandbox.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/rpc_integration.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/runner.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/settings.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/shared_context.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/statek_client_api.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/statek_push_queue.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/system.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/task.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/task_difficulty.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/testing.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek/utils.py +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek.egg-info/SOURCES.txt +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek.egg-info/dependency_links.txt +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek.egg-info/requires.txt +0 -0
- {statek-1.2.2 → statek-1.2.4}/statek.egg-info/top_level.txt +0 -0
|
@@ -614,7 +614,6 @@ class Job:
|
|
|
614
614
|
# The last dynamically-resolved difficulty level in this task.
|
|
615
615
|
self.__last_difficulty: Optional[TaskDifficulty] = None
|
|
616
616
|
self.usage = LLM_Usage(pricing=self._current_model_pricing())
|
|
617
|
-
self.error = None
|
|
618
617
|
# Number of completed DONE transitions (None until first completion)
|
|
619
618
|
self.num_completions: Optional[int] = None
|
|
620
619
|
# Application-specific external memo references, created lazily.
|
|
@@ -1218,9 +1217,17 @@ class Job:
|
|
|
1218
1217
|
continue
|
|
1219
1218
|
|
|
1220
1219
|
if isinstance(item, SubTaskLogItem):
|
|
1220
|
+
try:
|
|
1221
|
+
notification = item.handler.get_log_message()
|
|
1222
|
+
except Exception: # pylint: disable=broad-except
|
|
1223
|
+
task_id = f" id={item.handler.id}" if item.handler.id is not None else ""
|
|
1224
|
+
if item.handler.error is not None:
|
|
1225
|
+
notification = f"[Error] sub-task{task_id} failed."
|
|
1226
|
+
else:
|
|
1227
|
+
notification = f"[Notification] sub-task{task_id} completed successfully."
|
|
1221
1228
|
yield ChatHistoryItem(
|
|
1222
1229
|
role=ChatRole.SYSTEM,
|
|
1223
|
-
content=
|
|
1230
|
+
content=notification,
|
|
1224
1231
|
content_src=ContentSource.SYSTEM,
|
|
1225
1232
|
)
|
|
1226
1233
|
if item.tool_log is not None:
|
|
@@ -35,6 +35,7 @@ from statek.executors.job import (
|
|
|
35
35
|
Job,
|
|
36
36
|
JobStatus,
|
|
37
37
|
JobDef,
|
|
38
|
+
JobDefError,
|
|
38
39
|
job_def_identity_tag_for_job_def,
|
|
39
40
|
parse_warmup_code,
|
|
40
41
|
_job_def_identity_tag,
|
|
@@ -630,7 +631,8 @@ async def exec_step(code_str: str, job: Job, instr_num: Optional[int] = None,
|
|
|
630
631
|
|
|
631
632
|
async def exec_cli_step(code_str: str, job: Job, console_append: Callable,
|
|
632
633
|
instr_num: Optional[int] = None,
|
|
633
|
-
local_context: Optional[dict] = None
|
|
634
|
+
local_context: Optional[dict] = None,
|
|
635
|
+
error_append: Optional[Callable] = None) -> bool:
|
|
634
636
|
"""Execute a code block submitted via a ``python_cli`` tool request.
|
|
635
637
|
|
|
636
638
|
Behaves like :func:`exec_step` — same context sharing, temporal-function
|
|
@@ -643,6 +645,8 @@ async def exec_cli_step(code_str: str, job: Job, console_append: Callable,
|
|
|
643
645
|
job: the Job providing the execution context.
|
|
644
646
|
console_append: callback receiving each console output line.
|
|
645
647
|
instr_num: optional instruction index to resume from.
|
|
648
|
+
error_append: optional callback receiving each execution-error line.
|
|
649
|
+
When omitted, errors use ``console_append`` for compatibility.
|
|
646
650
|
|
|
647
651
|
Returns:
|
|
648
652
|
``True`` if ``exit()`` was called (program finished), ``False``
|
|
@@ -663,7 +667,7 @@ async def exec_cli_step(code_str: str, job: Job, console_append: Callable,
|
|
|
663
667
|
_exec_code_body(
|
|
664
668
|
code_str, job, global_context, local_context,
|
|
665
669
|
output_fn=console_append,
|
|
666
|
-
error_fn=console_append,
|
|
670
|
+
error_fn=error_append or console_append,
|
|
667
671
|
print_fn=cli_print,
|
|
668
672
|
instr_num=instr_num,
|
|
669
673
|
)
|
|
@@ -676,9 +680,10 @@ async def exec_cli_step(code_str: str, job: Job, console_append: Callable,
|
|
|
676
680
|
|
|
677
681
|
|
|
678
682
|
async def exec_all_steps(code: Union[str, CodeBlock], job: Job,
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
683
|
+
console_append: Callable,
|
|
684
|
+
instr_num: Optional[Union[int, Tuple[int, int]]] = None,
|
|
685
|
+
local_context: Optional[dict] = None,
|
|
686
|
+
error_append: Optional[Callable] = None) -> bool:
|
|
682
687
|
"""Execute regular code and any ``python_cli`` tool calls from a code block.
|
|
683
688
|
|
|
684
689
|
First executes the regular code (if present) via :func:`exec_step`, then
|
|
@@ -700,6 +705,7 @@ async def exec_all_steps(code: Union[str, CodeBlock], job: Job,
|
|
|
700
705
|
job: the Job providing the execution context.
|
|
701
706
|
console_append: callback ``(cli_tool_index, text)`` for CLI output.
|
|
702
707
|
instr_num: optional continuation position.
|
|
708
|
+
error_append: optional callback ``(cli_tool_index, text)`` for CLI errors.
|
|
703
709
|
|
|
704
710
|
Returns:
|
|
705
711
|
``True`` if ``exit()`` was called, ``False`` otherwise.
|
|
@@ -757,6 +763,7 @@ async def exec_all_steps(code: Union[str, CodeBlock], job: Job,
|
|
|
757
763
|
console_append=lambda s, _idx=cli_idx: console_append(_idx, s),
|
|
758
764
|
instr_num=step_instr,
|
|
759
765
|
local_context=local_context,
|
|
766
|
+
error_append=lambda s, _idx=cli_idx: (error_append or console_append)(_idx, s),
|
|
760
767
|
)
|
|
761
768
|
except FutureError as e:
|
|
762
769
|
e.instr_num = (cli_idx, e.instr_num)
|
|
@@ -1045,14 +1052,18 @@ async def run_job_step(job: Job, provider: str = None) -> bool:
|
|
|
1045
1052
|
|
|
1046
1053
|
# Step 6: Execute code and CLI tool calls using exec_all_steps
|
|
1047
1054
|
cli_outputs = {} # cli_idx -> list of output lines
|
|
1055
|
+
cli_errors = {} # cli_idx -> list of error lines
|
|
1048
1056
|
code_block = code if isinstance(code, CodeBlock) else CodeBlock(code=code)
|
|
1049
1057
|
|
|
1050
1058
|
def _cli_console_append(cli_idx, text):
|
|
1051
1059
|
cli_outputs.setdefault(cli_idx, []).append(text)
|
|
1052
1060
|
|
|
1061
|
+
def _cli_error_append(cli_idx, text):
|
|
1062
|
+
cli_errors.setdefault(cli_idx, []).append(text)
|
|
1063
|
+
|
|
1053
1064
|
try:
|
|
1054
1065
|
await exec_all_steps(code_block, job, _cli_console_append, job.next_instr_num,
|
|
1055
|
-
local_context=local_context)
|
|
1066
|
+
local_context=local_context, error_append=_cli_error_append)
|
|
1056
1067
|
|
|
1057
1068
|
# Clear continuation state after successful execution
|
|
1058
1069
|
job.awaited_result = None
|
|
@@ -1087,18 +1098,22 @@ async def run_job_step(job: Job, provider: str = None) -> bool:
|
|
|
1087
1098
|
]
|
|
1088
1099
|
for cli_idx in range(len(cli_calls)):
|
|
1089
1100
|
joined = "\n".join(cli_outputs.get(cli_idx, []))
|
|
1101
|
+
error = "\n".join(cli_errors.get(cli_idx, []))
|
|
1090
1102
|
if (last_chat_log_item is not None
|
|
1091
1103
|
and last_chat_log_item.tool_log is not None
|
|
1092
1104
|
and cli_idx < len(cli_tool_log_positions)):
|
|
1093
1105
|
j = cli_tool_log_positions[cli_idx]
|
|
1094
1106
|
if j < len(last_chat_log_item.tool_log):
|
|
1095
|
-
last_chat_log_item.tool_log[j] =
|
|
1107
|
+
last_chat_log_item.tool_log[j] = (
|
|
1108
|
+
ToolError(err_message=error) if error else joined
|
|
1109
|
+
)
|
|
1096
1110
|
|
|
1097
1111
|
# Step 9: If code has finished, transition to DONE and return True
|
|
1098
1112
|
if job.py_env.exit_status is not None:
|
|
1099
1113
|
# Apply the Step 16 follow-up guard before code-triggered DONE.
|
|
1100
1114
|
if _process_pending_notification_follow_up(job, harness):
|
|
1101
1115
|
return False
|
|
1116
|
+
harness.check_after_step(job)
|
|
1102
1117
|
job.set_status(JobStatus.DONE)
|
|
1103
1118
|
_log_pending_console(job)
|
|
1104
1119
|
return True
|
|
@@ -1195,6 +1210,7 @@ async def run_job_step(job: Job, provider: str = None) -> bool:
|
|
|
1195
1210
|
return False
|
|
1196
1211
|
if _process_pending_notification_follow_up(job, harness):
|
|
1197
1212
|
return False
|
|
1213
|
+
harness.check_after_step(job)
|
|
1198
1214
|
custom_exit(job)
|
|
1199
1215
|
job.set_status(JobStatus.DONE)
|
|
1200
1216
|
_log_pending_console(job)
|
|
@@ -1364,6 +1380,7 @@ async def job_worker(semaphore, job: Job, provider: str = None):
|
|
|
1364
1380
|
statek_log(error_msg, level='error')
|
|
1365
1381
|
job.py_env.exit_status = f"Error: {e}"
|
|
1366
1382
|
job.console_append(error_msg, error_message=error_msg)
|
|
1383
|
+
job.error = JobDefError(e)
|
|
1367
1384
|
job.set_status(JobStatus.DONE)
|
|
1368
1385
|
handle_critical_error(e)
|
|
1369
1386
|
except Exception as e:
|
|
@@ -1372,6 +1389,7 @@ async def job_worker(semaphore, job: Job, provider: str = None):
|
|
|
1372
1389
|
error_msg = f"Job {db0.uuid(job)} failed with error: {e}\n{traceback.format_exc()}"
|
|
1373
1390
|
statek_log(error_msg, level='error')
|
|
1374
1391
|
job.console_append(error_msg, error_message=error_msg)
|
|
1392
|
+
job.error = JobDefError(e)
|
|
1375
1393
|
job.set_status(JobStatus.DONE)
|
|
1376
1394
|
handle_critical_error(e)
|
|
1377
1395
|
|
|
@@ -144,19 +144,20 @@ def _resolve_reasoning_request(
|
|
|
144
144
|
raise ValueError("reasoning level must be an integer from 0 through 100") from exc
|
|
145
145
|
if not 0 <= level <= 100 or str(level) != aliases[0].strip():
|
|
146
146
|
raise ValueError("reasoning level must be an integer from 0 through 100")
|
|
147
|
-
if
|
|
148
|
-
if provider_config is None:
|
|
149
|
-
raise ValueError("positive reasoning level requires a provider configuration")
|
|
147
|
+
if provider_config is not None:
|
|
150
148
|
payload = provider_config.find_payload(
|
|
151
149
|
provider, model_name.model_family, model_name.model, reasoning_level=level)
|
|
152
|
-
if payload is None:
|
|
150
|
+
if payload is not None:
|
|
151
|
+
ignored_parameters = provider_config.find_ignored_parameters(
|
|
152
|
+
provider,
|
|
153
|
+
model_name.model_family,
|
|
154
|
+
model_name.model,
|
|
155
|
+
) or []
|
|
156
|
+
elif level > 0:
|
|
153
157
|
raise ValueError(
|
|
154
158
|
"positive reasoning level has no matching provider configuration payload")
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
model_name.model_family,
|
|
158
|
-
model_name.model,
|
|
159
|
-
) or []
|
|
159
|
+
elif level > 0:
|
|
160
|
+
raise ValueError("positive reasoning level requires a provider configuration")
|
|
160
161
|
upstream_model = (
|
|
161
162
|
format_model_for_provider(model_name, provider)
|
|
162
163
|
if provider is not None else (
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|