harness-sdk-python 0.28.0__tar.gz → 0.29.1__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.
Files changed (42) hide show
  1. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/PKG-INFO +1 -1
  2. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/pyproject.toml +1 -1
  3. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/src/harness_sdk/deepagents.py +6 -3
  4. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/src/harness_sdk/voice.py +4 -6
  5. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_deepagents_messages.py +14 -2
  6. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_voice.py +17 -7
  7. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/voice_helpers.py +5 -1
  8. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/.gitignore +0 -0
  9. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/README.md +0 -0
  10. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/examples/__init__.py +0 -0
  11. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/examples/runs_app.py +0 -0
  12. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/src/harness_sdk/__init__.py +0 -0
  13. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/src/harness_sdk/checkpoints.py +0 -0
  14. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/src/harness_sdk/fenced_postgres.py +0 -0
  15. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/src/harness_sdk/linear_thread.py +0 -0
  16. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/src/harness_sdk/run_manager.py +0 -0
  17. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/run_helpers.py +0 -0
  18. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_admit_steer.py +0 -0
  19. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_applied_visibility.py +0 -0
  20. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_batches.py +0 -0
  21. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_branch_anchor.py +0 -0
  22. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_checkpoints.py +0 -0
  23. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_dispatching.py +0 -0
  24. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_durability.py +0 -0
  25. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_edit_dispatched.py +0 -0
  26. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_edit_reload.py +0 -0
  27. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_enqueue.py +0 -0
  28. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_fenced_postgres.py +0 -0
  29. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_input_required.py +0 -0
  30. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_linear_thread.py +0 -0
  31. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_meta.py +0 -0
  32. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_mint_concurrency.py +0 -0
  33. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_outcomes.py +0 -0
  34. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_placement.py +0 -0
  35. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_prepare_hooks.py +0 -0
  36. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_restore.py +0 -0
  37. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_rewind_during_run.py +0 -0
  38. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_run_crash_sweep.py +0 -0
  39. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_settle.py +0 -0
  40. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_steer.py +0 -0
  41. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_stop_continue.py +0 -0
  42. {harness_sdk_python-0.28.0 → harness_sdk_python-0.29.1}/tests/test_stopping_window.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: harness-sdk-python
3
- Version: 0.28.0
3
+ Version: 0.29.1
4
4
  Summary: RunManager: the harness-sdk runs subsystem for Python Statewire hosts
5
5
  Project-URL: Repository, https://github.com/assistant-ui/harness-sdk
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "harness-sdk-python"
3
- version = "0.28.0"
3
+ version = "0.29.1"
4
4
  description = "RunManager: the harness-sdk runs subsystem for Python Statewire hosts"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -1,7 +1,8 @@
1
1
  """DeepagentsMessages: the ``messages`` slice of a Statewire host, projected
2
2
  from a langgraph checkpointer in the deepagents dialect. The checkpointer is
3
3
  the source of truth and the wire state is its projection, restamped with
4
- ``branch: {id, siblings}`` metadata after every ingest. A rewind restores the
4
+ ``branch: {id, siblings}`` metadata after every ingest; ephemeral overlay
5
+ entries carry ``ephemeral: true`` instead. A rewind restores the
5
6
  projection from the target message's anchor checkpoint; a branch switch clones
6
7
  the target branch's tip as the checkpointer's latest checkpoint, so resumption
7
8
  and reboot both land on the switched world.
@@ -243,7 +244,7 @@ class DeepagentsMessages:
243
244
  return snapshot
244
245
 
245
246
  def upsert_ephemeral_message(self, message: dict[str, Any]) -> None:
246
- """Render an in-flight ``{id, role, text}`` entry in ``state["messages"]``; an ``append_messages`` of the same id replaces it durably."""
247
+ """Render an in-flight ``{id, role, text}`` entry in ``state["messages"]`` tagged ``ephemeral: true``; an ``append_messages`` of the same id replaces it durably."""
247
248
  if message["role"] not in ("user", "assistant"):
248
249
  raise ValueError(f"unsupported message role: {message['role']!r}")
249
250
  if message["id"] not in self._ephemeral and any(
@@ -280,6 +281,8 @@ class DeepagentsMessages:
280
281
  stamped.append({**message, "branch": {"id": branch, "siblings": siblings}})
281
282
  durable = {message["id"] for message in stamped}
282
283
  stamped.extend(
283
- entry for id_, entry in self._ephemeral.items() if id_ not in durable
284
+ {**entry, "ephemeral": True}
285
+ for id_, entry in self._ephemeral.items()
286
+ if id_ not in durable
284
287
  )
285
288
  self._replace(stamped)
@@ -9,11 +9,12 @@ and the turn commit both stay host-owned.
9
9
 
10
10
  ``voice/start {offer}`` seeds the provider from the thread transcript (at
11
11
  most 128 messages, tail taken) and projects ``state["voice"] = {clientId,
12
- status, answer}`` — the SDP answer rides the applied state. The session is
13
- bound to the issuing client's connection: ``voice/end`` from the owner, a
12
+ status}`` — the SDP answer rides only the command's result payload
13
+ ``{answer}``. The session is bound to the issuing client's connection: ``voice/end`` from the owner, a
14
14
  provider ``closed`` event, or a connection drop ends it. Provider turn
15
15
  events render live in ``state["messages"]`` through
16
- ``Host.upsert_ephemeral_message`` (message id = turn id); each completed
16
+ ``Host.upsert_ephemeral_message`` (message id = turn id), tagged
17
+ ``ephemeral: true`` on the wire; each completed
17
18
  turn commits through ``Host.commit_voice_turns`` (serialized, in
18
19
  done-order) and the durable entry replaces the ephemeral one under the
19
20
  same id, a failed commit keeps its turns for the next flush; session end
@@ -69,13 +70,11 @@ class VoiceManager(Tray):
69
70
 
70
71
  clientId = observable(None)
71
72
  status = observable("connecting")
72
- answer = observable(None)
73
73
 
74
74
  state = observable(
75
75
  {
76
76
  "clientId": clientId,
77
77
  "status": status,
78
- "answer": answer,
79
78
  }
80
79
  )
81
80
 
@@ -161,7 +160,6 @@ class VoiceManager(Tray):
161
160
  self.delete()
162
161
  raise _reject("voice-unavailable", f"voice session failed to start: {exc}")
163
162
  self._provider = provider
164
- self.answer.value = answer
165
163
  self.status.value = "live"
166
164
  applied()
167
165
  self._watcher = self._spawn(self._watch(caller))
@@ -170,10 +170,16 @@ async def test_ingest_turn_refetch_discards_the_capture():
170
170
  async def test_ephemeral_message_renders_and_updates_in_place():
171
171
  _, _, _, messages, state = await seeded()
172
172
  messages.upsert_ephemeral_message({"id": "v1", "role": "user", "text": "hel"})
173
- assert state["messages"][-1] == {"id": "v1", "type": "human", "content": "hel"}
173
+ assert state["messages"][-1] == {
174
+ "id": "v1",
175
+ "type": "human",
176
+ "content": "hel",
177
+ "ephemeral": True,
178
+ }
174
179
  messages.upsert_ephemeral_message({"id": "v1", "role": "user", "text": "hello"})
175
180
  assert ids(state) == ["u1", "a0", "u2", "a1", "v1"]
176
181
  assert state["messages"][-1]["content"] == "hello"
182
+ assert all("ephemeral" not in m for m in state["messages"][:-1])
177
183
 
178
184
 
179
185
  async def test_ephemeral_message_survives_a_turn_ingest():
@@ -181,7 +187,12 @@ async def test_ephemeral_message_survives_a_turn_ingest():
181
187
  messages.upsert_ephemeral_message({"id": "v1", "role": "assistant", "text": "hi"})
182
188
  await turn(graph, messages, Ctx("message-send", (user("u3", "three"),)))
183
189
  assert ids(state) == ["u1", "a0", "u2", "a1", "u3", "a2", "v1"]
184
- assert state["messages"][-1] == {"id": "v1", "type": "ai", "content": "hi"}
190
+ assert state["messages"][-1] == {
191
+ "id": "v1",
192
+ "type": "ai",
193
+ "content": "hi",
194
+ "ephemeral": True,
195
+ }
185
196
 
186
197
 
187
198
  async def test_append_messages_replaces_the_ephemeral_entry_durably():
@@ -190,6 +201,7 @@ async def test_append_messages_replaces_the_ephemeral_entry_durably():
190
201
  await messages.append_messages([{"id": "v1", "role": "user", "text": "spoken"}])
191
202
  assert ids(state) == ["u1", "a0", "u2", "a1", "v1"]
192
203
  assert "branch" in state["messages"][-1]
204
+ assert "ephemeral" not in state["messages"][-1]
193
205
  messages.drop_ephemeral_message("v1")
194
206
  assert ids(state) == ["u1", "a0", "u2", "a1", "v1"]
195
207
 
@@ -39,11 +39,7 @@ async def test_start_seeds_provider_and_projects_session():
39
39
  assert bench.provider.calls == [("start", OFFER, bench.transcript)]
40
40
  await drv.wait(lambda s: (voice_of(s) or {}).get("status") == "live")
41
41
  voice = voice_of(drv.replica)
42
- assert voice == {
43
- "clientId": drv.client_id,
44
- "status": "live",
45
- "answer": ANSWER,
46
- }
42
+ assert voice == {"clientId": drv.client_id, "status": "live"}
47
43
  assert bench.contexts[0].client_id == drv.client_id
48
44
 
49
45
 
@@ -92,7 +88,14 @@ async def test_turn_streams_into_messages_ephemerally():
92
88
  events.turn_delta("t1", "there")
93
89
  await drv.wait(
94
90
  lambda s: messages_of(s)
95
- == [{"id": "t1", "type": "human", "content": "hello there"}]
91
+ == [
92
+ {
93
+ "id": "t1",
94
+ "type": "human",
95
+ "content": "hello there",
96
+ "ephemeral": True,
97
+ }
98
+ ]
96
99
  )
97
100
  assert bench.commits == []
98
101
 
@@ -145,7 +148,14 @@ async def test_commit_failure_keeps_the_turn_until_the_next_flush():
145
148
  assert bench.commits == []
146
149
  await drv.wait(
147
150
  lambda s: messages_of(s)
148
- == [{"id": "t1", "type": "human", "content": "question"}]
151
+ == [
152
+ {
153
+ "id": "t1",
154
+ "type": "human",
155
+ "content": "question",
156
+ "ephemeral": True,
157
+ }
158
+ ]
149
159
  )
150
160
  # session end retries the kept turn
151
161
  await drv.command("voice/end")
@@ -83,7 +83,11 @@ def make_voice_host(bench: Bench, *, declare: bool = True):
83
83
  durable_ids = {m["id"] for m in self._durable}
84
84
  self.state["messages"] = [
85
85
  *self._durable,
86
- *(e for i, e in self._ephemeral.items() if i not in durable_ids),
86
+ *(
87
+ {**e, "ephemeral": True}
88
+ for i, e in self._ephemeral.items()
89
+ if i not in durable_ids
90
+ ),
87
91
  ]
88
92
 
89
93
  async def get_voice_seed(self):