@lmmslab/harness 0.0.0-stage → 0.81.0
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/LICENSE +21 -0
- package/README.md +124 -2
- package/bin/harness.js +71 -0
- package/package.json +34 -4
- package/python/harness/README.md +72 -0
- package/python/harness/__init__.py +8 -0
- package/python/harness/__main__.py +3 -0
- package/python/harness/bench.py +124 -0
- package/python/harness/builtin/benches/README.md +5 -0
- package/python/harness/builtin/benches/none/bench.toml +6 -0
- package/python/harness/builtin/configs/README.md +26 -0
- package/python/harness/builtin/configs/assistant.toml +11 -0
- package/python/harness/builtin/configs/default.toml +33 -0
- package/python/harness/builtin/configs/deploy/example-api.toml +10 -0
- package/python/harness/builtin/configs/models/deepseek-api.toml +21 -0
- package/python/harness/builtin/configs/models/deepseek-flash.toml +12 -0
- package/python/harness/builtin/configs/models/grok-low.toml +8 -0
- package/python/harness/builtin/configs/models/grok-medium.toml +43 -0
- package/python/harness/builtin/configs/models/opus-5.5.toml +11 -0
- package/python/harness/builtin/environment/README.md +53 -0
- package/python/harness/builtin/environment/constraints.txt +31 -0
- package/python/harness/builtin/model-settings.js +143 -0
- package/python/harness/builtin/prompts/conversation/core.md +5 -0
- package/python/harness/builtin/prompts/conversation/pack.toml +12 -0
- package/python/harness/builtin/prompts/core/core.md +88 -0
- package/python/harness/builtin/prompts/core/pack.toml +9 -0
- package/python/harness/builtin/prompts/reflect/core.md +45 -0
- package/python/harness/builtin/prompts/reflect/pack.toml +7 -0
- package/python/harness/builtin/prompts/shared/agent-skills.md +5 -0
- package/python/harness/builtin/prompts/shared/agents.md +14 -0
- package/python/harness/builtin/prompts/shared/checklist.md +21 -0
- package/python/harness/builtin/prompts/shared/entries.md +86 -0
- package/python/harness/builtin/prompts/shared/environments.md +21 -0
- package/python/harness/builtin/prompts/shared/learning-goal.md +31 -0
- package/python/harness/builtin/prompts/shared/learning.md +27 -0
- package/python/harness/builtin/prompts/shared/mcp.md +9 -0
- package/python/harness/builtin/prompts/shared/world.md +1 -0
- package/python/harness/builtin/skills/README.md +10 -0
- package/python/harness/builtin/skills/agents/__init__.py +88 -0
- package/python/harness/builtin/skills/agents/skill.toml +11 -0
- package/python/harness/builtin/skills/checklist/__init__.py +32 -0
- package/python/harness/builtin/skills/checklist/skill.toml +9 -0
- package/python/harness/builtin/skills/conversation/__init__.py +23 -0
- package/python/harness/builtin/skills/conversation/skill.toml +8 -0
- package/python/harness/builtin/skills/entries/__init__.py +62 -0
- package/python/harness/builtin/skills/entries/skill.toml +8 -0
- package/python/harness/builtin/skills/environments/__init__.py +69 -0
- package/python/harness/builtin/skills/environments/skill.toml +9 -0
- package/python/harness/builtin/skills/experience/__init__.py +27 -0
- package/python/harness/builtin/skills/experience/skill.toml +9 -0
- package/python/harness/builtin/skills/instructions/__init__.py +29 -0
- package/python/harness/builtin/skills/instructions/skill.toml +9 -0
- package/python/harness/builtin/skills/learning/__init__.py +189 -0
- package/python/harness/builtin/skills/learning/skill.toml +7 -0
- package/python/harness/builtin/skills/mcp/__init__.py +54 -0
- package/python/harness/builtin/skills/mcp/skill.toml +10 -0
- package/python/harness/builtin/skills/memory/__init__.py +130 -0
- package/python/harness/builtin/skills/memory/skill.toml +13 -0
- package/python/harness/builtin/skills/verify/__init__.py +31 -0
- package/python/harness/builtin/skills/verify/skill.toml +7 -0
- package/python/harness/builtin/third_party/sources.toml +40 -0
- package/python/harness/cli.py +1182 -0
- package/python/harness/config/__init__.py +224 -0
- package/python/harness/config/agent.py +777 -0
- package/python/harness/core/__init__.py +52 -0
- package/python/harness/core/artifacts.py +46 -0
- package/python/harness/core/codec.py +160 -0
- package/python/harness/core/contracts.py +75 -0
- package/python/harness/core/episodes.py +150 -0
- package/python/harness/core/format.py +51 -0
- package/python/harness/core/http.py +124 -0
- package/python/harness/core/lanes.py +324 -0
- package/python/harness/core/linux_sandbox.py +55 -0
- package/python/harness/core/media.py +96 -0
- package/python/harness/core/memory.py +147 -0
- package/python/harness/core/ports.py +63 -0
- package/python/harness/core/procs.py +227 -0
- package/python/harness/core/remote.py +102 -0
- package/python/harness/core/spans.py +166 -0
- package/python/harness/core/trace.py +139 -0
- package/python/harness/core/wait.py +12 -0
- package/python/harness/core/worker.py +388 -0
- package/python/harness/core/worker_pipe.py +119 -0
- package/python/harness/embodiments.py +217 -0
- package/python/harness/extensions.py +112 -0
- package/python/harness/host/__init__.py +397 -0
- package/python/harness/host/client.py +201 -0
- package/python/harness/host/http.py +720 -0
- package/python/harness/host/listing.py +68 -0
- package/python/harness/host/server.py +189 -0
- package/python/harness/host/sessions.py +406 -0
- package/python/harness/host/tasks.py +1308 -0
- package/python/harness/host/workers.py +257 -0
- package/python/harness/host/workspaces.py +256 -0
- package/python/harness/model_list.py +117 -0
- package/python/harness/packages/__init__.py +73 -0
- package/python/harness/packages/addons.py +121 -0
- package/python/harness/packages/archive.py +122 -0
- package/python/harness/packages/describe.py +46 -0
- package/python/harness/packages/environments.py +448 -0
- package/python/harness/packages/fetch.py +57 -0
- package/python/harness/packages/manager.py +587 -0
- package/python/harness/packages/manifest.py +221 -0
- package/python/harness/packages/migrate.py +68 -0
- package/python/harness/packages/provision.py +38 -0
- package/python/harness/packages/registry.py +275 -0
- package/python/harness/packages/resolve.py +89 -0
- package/python/harness/packages/sources.py +141 -0
- package/python/harness/packages/state.py +213 -0
- package/python/harness/packages/versions.py +112 -0
- package/python/harness/paths.py +218 -0
- package/python/harness/providers.py +303 -0
- package/python/harness/runtime/__init__.py +8 -0
- package/python/harness/runtime/decision/__init__.py +1 -0
- package/python/harness/runtime/decision/loop.py +198 -0
- package/python/harness/runtime/decision/messages.py +271 -0
- package/python/harness/runtime/decision/model.py +424 -0
- package/python/harness/runtime/decision/prompts.py +248 -0
- package/python/harness/runtime/decision/protocol.py +169 -0
- package/python/harness/runtime/decision/thoughts.py +199 -0
- package/python/harness/runtime/events.py +213 -0
- package/python/harness/runtime/execution/__init__.py +1 -0
- package/python/harness/runtime/execution/attached.py +96 -0
- package/python/harness/runtime/execution/control.py +211 -0
- package/python/harness/runtime/execution/entries.py +665 -0
- package/python/harness/runtime/execution/kernel.py +811 -0
- package/python/harness/runtime/execution/noenv.py +84 -0
- package/python/harness/runtime/execution/results.py +40 -0
- package/python/harness/runtime/execution/session.py +871 -0
- package/python/harness/runtime/execution/skills.py +436 -0
- package/python/harness/runtime/learning/__init__.py +1 -0
- package/python/harness/runtime/learning/active.py +314 -0
- package/python/harness/runtime/learning/experience.py +48 -0
- package/python/harness/runtime/learning/fixtures.py +167 -0
- package/python/harness/runtime/learning/learner.py +651 -0
- package/python/harness/runtime/learning/library.py +504 -0
- package/python/harness/runtime/learning/reflect.py +151 -0
- package/python/harness/runtime/learning/usage.py +30 -0
- package/python/harness/runtime/learning/views.py +89 -0
- package/python/harness/runtime/reactive/__init__.py +1 -0
- package/python/harness/runtime/reactive/rules.py +549 -0
- package/python/harness/runtime/safety/__init__.py +1 -0
- package/python/harness/runtime/safety/approval.py +131 -0
- package/python/harness/runtime/safety/input.py +62 -0
- package/python/harness/runtime/safety/isolation.py +419 -0
- package/python/harness/runtime/safety/shield.py +129 -0
- package/python/harness/runtime/status.py +23 -0
- package/python/harness/runtime/task/__init__.py +7 -0
- package/python/harness/runtime/task/context.py +431 -0
- package/python/harness/runtime/task/delegation.py +468 -0
- package/python/harness/runtime/task/environments.py +268 -0
- package/python/harness/runtime/task/run.py +2878 -0
- package/python/harness/runtime/tick.py +909 -0
- package/python/harness/sdk/__init__.py +281 -0
- package/python/harness/services/__init__.py +6 -0
- package/python/harness/services/broker.py +35 -0
- package/python/harness/services/connectors.py +88 -0
- package/python/harness/services/mcp.py +298 -0
- package/python/harness/services/mcp_stdio.py +131 -0
- package/python/harness/services/placement.py +82 -0
- package/python/harness/services/registry.py +156 -0
- package/python/harness/settings.py +536 -0
- package/python/harness/terminal.py +79 -0
- package/python/harness/transcript.py +297 -0
- package/python/harness/tui/__init__.py +68 -0
- package/python/harness/tui/chat.py +1181 -0
- package/python/harness/tui/pty.py +81 -0
- package/python/harness/tui/renderer.py +45 -0
- package/python/harness/tui/timeline_rows.py +58 -0
- package/python/harness/tui/views.py +434 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""A conversation without an environment: the model, its programs and the connected tools.
|
|
2
|
+
|
|
3
|
+
The workspace kind `none` (host/workspaces.py) takes no worker: nothing is started, there
|
|
4
|
+
is no screen and no project. The task run and the kernel still speak the worker protocol,
|
|
5
|
+
so each of them gets a NoEnvironment of its own in its process, which answers it with an
|
|
6
|
+
empty state and no view. The kernel's session (NoSession) is the episode core with nothing
|
|
7
|
+
to send: programs compute, call the connected tools (MCP) and finish.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import uuid
|
|
11
|
+
|
|
12
|
+
from harness.core.contracts import Observation
|
|
13
|
+
from harness.runtime.execution.session import EpisodeCore
|
|
14
|
+
|
|
15
|
+
KIND = "none"
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class NoEnvironment:
|
|
19
|
+
"""The worker protocol of nothing: one episode, an empty state, no views, no outcome to score."""
|
|
20
|
+
|
|
21
|
+
name = KIND
|
|
22
|
+
timeout = 30.0
|
|
23
|
+
approval_key = None
|
|
24
|
+
host_controls = frozenset()
|
|
25
|
+
program_controls = frozenset()
|
|
26
|
+
|
|
27
|
+
def __init__(self, episode_id: str | None = None):
|
|
28
|
+
self.episode_id = episode_id or uuid.uuid4().hex
|
|
29
|
+
self.state = {"step": 0, "ended": False}
|
|
30
|
+
|
|
31
|
+
def tools(self) -> list:
|
|
32
|
+
return []
|
|
33
|
+
|
|
34
|
+
def reset(self, task: str, seed: int) -> Observation:
|
|
35
|
+
return Observation(self.episode_id, 0, "", dict(self.state))
|
|
36
|
+
|
|
37
|
+
def call(self, name: str, **arguments):
|
|
38
|
+
if name == "profile":
|
|
39
|
+
return {"kind": KIND, "name": KIND, "benchmark": KIND, "clock": "events", "control_hz": 1,
|
|
40
|
+
"steps_shown": False}
|
|
41
|
+
if name == "state":
|
|
42
|
+
return dict(self.state)
|
|
43
|
+
if name == "observe":
|
|
44
|
+
return {"state": dict(self.state), "images": {}}
|
|
45
|
+
if name == "claim_outcome":
|
|
46
|
+
return {"token": self.episode_id}
|
|
47
|
+
if name == "outcome":
|
|
48
|
+
# Nothing scores a conversation: success None, which the frontends do not show.
|
|
49
|
+
return {"success": None, "reward": None, "process_score": None, "steps": 0, "closed": True}
|
|
50
|
+
if name == "tick":
|
|
51
|
+
return {"executed": True, "shield": {"command": arguments.get("command"), "reasons": []},
|
|
52
|
+
"state": dict(self.state)}
|
|
53
|
+
raise RuntimeError(f"There is no environment in this conversation: {name} needs one")
|
|
54
|
+
|
|
55
|
+
def close(self) -> None:
|
|
56
|
+
pass
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def create_environment(options=None):
|
|
60
|
+
"""The bench's worker factory (benches/none): what a worker of nothing would serve."""
|
|
61
|
+
return NoEnvironment()
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class NoSession(EpisodeCore):
|
|
65
|
+
"""The episode core with no environment behind it."""
|
|
66
|
+
|
|
67
|
+
embodiment = KIND
|
|
68
|
+
|
|
69
|
+
def __init__(self, options, *, environment=None):
|
|
70
|
+
super().__init__(options, environment=environment or NoEnvironment(options.get("episode_id")))
|
|
71
|
+
|
|
72
|
+
def _base_command(self, state):
|
|
73
|
+
return None
|
|
74
|
+
|
|
75
|
+
def _tick(self, command, cameras=None):
|
|
76
|
+
receipt = self.env.call("tick", command=command)
|
|
77
|
+
self.state = receipt["state"]
|
|
78
|
+
return receipt
|
|
79
|
+
|
|
80
|
+
def _reactive_view(self, state, tick):
|
|
81
|
+
return dict(state)
|
|
82
|
+
|
|
83
|
+
def _outside(self, region, state):
|
|
84
|
+
return False
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"""Interpret program receipts and finalize an episode without owning task state."""
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def _taken_over(result: dict) -> dict | None:
|
|
5
|
+
"""The worker's reason when a step was refused because the user brought a window of
|
|
6
|
+
theirs to the front (a worker that sends the user's real input: the computer's,
|
|
7
|
+
Minecraft's), else None."""
|
|
8
|
+
for item in result.get("events") or []:
|
|
9
|
+
for reason in ((item.get("event") or {}).get("detail") or {}).get("reasons") or []:
|
|
10
|
+
if isinstance(reason, dict) and reason.get("took_over"):
|
|
11
|
+
return reason
|
|
12
|
+
return None
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _cell_usage(summary: dict, result: dict) -> None:
|
|
16
|
+
"""Fold what a program did below the high level into the episode summary: events
|
|
17
|
+
its handlers resolved, the one that escalated, and model calls made from inside
|
|
18
|
+
the program (pointing and questions)."""
|
|
19
|
+
summary["events_handled"] += sum(1 for item in result.get("events", []) if item.get("handled"))
|
|
20
|
+
summary["events_escalated"] += 1 if result.get("status") == "escalated" else 0
|
|
21
|
+
from harness.runtime.decision.model import add_usage
|
|
22
|
+
|
|
23
|
+
for role, usage in (result.get("usage") or {}).items():
|
|
24
|
+
add_usage(summary, usage)
|
|
25
|
+
if role == "verifier":
|
|
26
|
+
summary["verifier_calls"] += int(usage.get("calls") or 0)
|
|
27
|
+
else:
|
|
28
|
+
summary["vision_calls"] += int(usage.get("calls") or 0)
|
|
29
|
+
summary["vision_cost_usd"] += float(usage.get("cost_usd") or 0.0)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _wrap_up(kernel, trace):
|
|
33
|
+
"""The benchmark's end-of-episode convention, the same for every layer: the kernel
|
|
34
|
+
returns the arms to their start pose when the embodiment profile asks for it."""
|
|
35
|
+
try:
|
|
36
|
+
result = kernel.run("__wrap_up__()", timeout=120)
|
|
37
|
+
trace.emit("wrap_up", status=result["status"], error=result.get("error"),
|
|
38
|
+
events=[event.get("event", {}).get("kind") for event in result.get("events") or []])
|
|
39
|
+
except Exception as error:
|
|
40
|
+
trace.emit("cleanup_error", message=f"wrap_up: {type(error).__name__}: {error}")
|