fix(sdk): keep query internal and return session identity

This commit is contained in:
LogosVeritas committed 2026-10-28 17:15:21 +08:00
1 parent 9976a87e97
commit 1950259ce1
25 files changed
+229 -111

No files matched your search

+3 -3
View File
@@ -7,12 +7,12 @@ import argparse
import os
from pathlib import Path
from deepseek_harness import CommandExecution, DeepSeekHarness, RunResult
from deepseek_harness import RunCommandResult, DeepSeekHarness, RunResult
def display(result: RunResult | CommandExecution) -> None:
def display(result: RunResult | RunCommandResult) -> None:
"""Print the input's result and stop on a reported failure."""
if isinstance(result, CommandExecution):
if isinstance(result, RunCommandResult):
print(f"Command {result.command_id}: {result.result.kind}")
if result.result.kind == "error":
raise RuntimeError(result.result.text)
+2 -2
View File
@@ -11,7 +11,7 @@ from pathlib import Path
from pydantic import BaseModel
from deepseek_harness import CommandExecution, DeepSeekHarness, Notification
from deepseek_harness import RunCommandResult, DeepSeekHarness, Notification
from deepseek_harness.api import final_response
@@ -68,7 +68,7 @@ def main() -> None:
return event
execution = session.run(f"/goal {args.objective}")
if not isinstance(execution, CommandExecution):
if not isinstance(execution, RunCommandResult):
raise RuntimeError("The SDK profile did not execute the requested command")
print(execution.result.text, flush=True)
if execution.result.kind == "error":
+2 -2
View File
@@ -7,7 +7,7 @@ import argparse
import os
from pathlib import Path
from deepseek_harness import CommandExecution, DeepSeekHarness
from deepseek_harness import RunCommandResult, DeepSeekHarness
def main() -> None:
@@ -41,7 +41,7 @@ def main() -> None:
profile=args.profile,
) as harness:
result = harness.run(args.prompt, session_id=args.session_id)
if isinstance(result, CommandExecution):
if isinstance(result, RunCommandResult):
if result.result.kind == "error":
raise RuntimeError(result.result.text)
print(result.result.text or "")
+3 -3
View File
@@ -7,12 +7,12 @@ import argparse
import os
from pathlib import Path
from deepseek_harness import CommandExecution, DeepSeekHarness, RunResult
from deepseek_harness import RunCommandResult, DeepSeekHarness, RunResult
def display(result: RunResult | CommandExecution) -> None:
def display(result: RunResult | RunCommandResult) -> None:
"""Print the input's result and stop on a reported failure."""
if isinstance(result, CommandExecution):
if isinstance(result, RunCommandResult):
print(f"Command {result.command_id}: {result.result.kind}")
if result.result.kind == "error":
raise RuntimeError(result.result.text)
+2 -2
View File
@@ -13,7 +13,7 @@ from pathlib import Path
from pydantic import BaseModel
from deepseek_harness import CommandExecution, DeepSeekHarness, Notification, UserQuestionRequest
from deepseek_harness import RunCommandResult, DeepSeekHarness, Notification, UserQuestionRequest
from deepseek_harness.api import final_response
@@ -173,7 +173,7 @@ def main() -> None:
session = harness.start_session()
with closing(harness.client.subscribe_session_notifications(session.id)) as notifications:
execution = session.run(f"/plan {args.task}")
if not isinstance(execution, CommandExecution):
if not isinstance(execution, RunCommandResult):
raise RuntimeError("The SDK profile did not execute the requested command")
print(execution.result.text, flush=True)
if execution.result.kind == "error":