bitfab-py 0.78.2__tar.gz → 0.78.3__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 (75) hide show
  1. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/PKG-INFO +1 -1
  2. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/gmail_sandbox.py +212 -39
  3. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/pyproject.toml +1 -1
  4. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/README.md +0 -0
  5. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/__init__.py +0 -0
  6. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/agent_middleware.py +0 -0
  7. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/approval.py +0 -0
  8. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/assertion_categories.py +0 -0
  9. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/baml.py +0 -0
  10. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/baml_auto_trace.py +0 -0
  11. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/categories.py +0 -0
  12. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/claude_agent_sdk.py +0 -0
  13. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/client.py +0 -0
  14. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/client_patching.py +0 -0
  15. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/cloudReplay.py +0 -0
  16. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/cloud_replay_cli.py +0 -0
  17. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/commit_ref.py +0 -0
  18. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/compress.py +0 -0
  19. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/constants.py +0 -0
  20. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/datasets.py +0 -0
  21. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/db_snapshot.py +0 -0
  22. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/error_chain.py +0 -0
  23. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/experiment_id.py +0 -0
  24. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/experiments.py +0 -0
  25. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/finalizers.py +0 -0
  26. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/git_command.py +0 -0
  27. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/git_state.py +0 -0
  28. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/google_calls.py +0 -0
  29. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/graders.py +0 -0
  30. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/http.py +0 -0
  31. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/integration_fixture.py +0 -0
  32. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/jev.py +0 -0
  33. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/labels.py +0 -0
  34. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/langgraph.py +0 -0
  35. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/langgraph_integration.py +0 -0
  36. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/langgraph_runs.py +0 -0
  37. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/mock_matching.py +0 -0
  38. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/mock_override.py +0 -0
  39. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/openai_agent_sdk.py +0 -0
  40. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/openai_agents_usage.py +0 -0
  41. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/organization_members.py +0 -0
  42. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/otel.py +0 -0
  43. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/payload_budget.py +0 -0
  44. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/processor_payload.py +0 -0
  45. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/provider_calls.py +0 -0
  46. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/replay.py +0 -0
  47. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/replay_branch.py +0 -0
  48. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/replay_cli.py +0 -0
  49. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/replay_heartbeat.py +0 -0
  50. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/replay_interrupt.py +0 -0
  51. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/replay_invocation.py +0 -0
  52. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/replay_memory.py +0 -0
  53. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/replay_processes.py +0 -0
  54. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/replay_registry.py +0 -0
  55. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/sandbox.py +0 -0
  56. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/seed_cli.py +0 -0
  57. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/selective_replay.py +0 -0
  58. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/serialize.py +0 -0
  59. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/service_calls.py +0 -0
  60. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/simulation_plan.py +0 -0
  61. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/span_meta.py +0 -0
  62. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/span_origin.py +0 -0
  63. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/spans.py +0 -0
  64. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/subtree.py +0 -0
  65. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/thread_propagation.py +0 -0
  66. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/timestamp.py +0 -0
  67. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/trace_completion.py +0 -0
  68. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/trace_metadata.py +0 -0
  69. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/trace_payload.py +0 -0
  70. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/traces.py +0 -0
  71. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/tracing.py +0 -0
  72. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/transport.py +0 -0
  73. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/transport_types.py +0 -0
  74. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/verdicts.py +0 -0
  75. {bitfab_py-0.78.2 → bitfab_py-0.78.3}/bitfab/warn_once.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bitfab-py
3
- Version: 0.78.2
3
+ Version: 0.78.3
4
4
  Summary: Bitfab client for provider-based API calls with local BAML execution
5
5
  Author: Harvest Team
6
6
  Requires-Python: >=3.10
@@ -22,6 +22,9 @@ PROFILE_METHOD = "gmail.users.getProfile"
22
22
  LABELS_LIST_METHOD = "gmail.users.labels.list"
23
23
  LABEL_GET_METHOD = "gmail.users.labels.get"
24
24
  SEND_AS_LIST_METHOD = "gmail.users.settings.sendAs.list"
25
+ DRAFT_GET_METHOD = "gmail.users.drafts.get"
26
+ DRAFT_LIST_METHOD = "gmail.users.drafts.list"
27
+ DRAFT_CREATE_METHOD = "gmail.users.drafts.create"
25
28
  SYSTEM_LABELS = (
26
29
  "INBOX",
27
30
  "SENT",
@@ -167,6 +170,26 @@ def gmail_message(fields: dict[str, Any]) -> dict[str, Any]:
167
170
  return message
168
171
 
169
172
 
173
+ def _fields_from_raw(raw: str | None) -> dict[str, Any]:
174
+ parsed = email.message_from_string(
175
+ _unb64(raw) if raw else "", policy=email.policy.default
176
+ )
177
+ body_part = (
178
+ parsed.get_body(preferencelist=("plain", "html"))
179
+ if parsed.is_multipart()
180
+ else parsed
181
+ )
182
+ body = body_part.get_content() if body_part is not None else ""
183
+ return {
184
+ **{
185
+ key: str(parsed.get(header))
186
+ for key, header in _PLAIN_HEADERS.items()
187
+ if parsed.get(header)
188
+ },
189
+ "body": str(body),
190
+ }
191
+
192
+
170
193
  def _richer(
171
194
  existing: dict[str, Any] | None, candidate: dict[str, Any]
172
195
  ) -> dict[str, Any]:
@@ -182,11 +205,19 @@ def mailbox_from_recorded_calls(ctx: SandboxStartCtx) -> dict[str, Any]:
182
205
 
183
206
  Uses the state recorded with ``record_sandbox_state("Gmail", ...)`` when
184
207
  there is one. Otherwise takes every message the original run read
185
- (``gmail.users.messages.get`` replies) and each account's address from
186
- ``gmail.users.getProfile``, one mailbox per credential the calls used.
208
+ (``gmail.users.messages.get`` replies), each account's address from
209
+ ``gmail.users.getProfile``, and the drafts the run found
210
+ (``gmail.users.drafts.list`` and ``gmail.users.drafts.get`` replies, the
211
+ first read of each draft), one mailbox per credential the calls used.
212
+ Drafts the original run created are left out.
187
213
  """
188
214
  if ctx.recorded_state is not None:
189
215
  return as_mailboxes(ctx, ctx.recorded_state)
216
+ created = {
217
+ str(span.output.get("id"))
218
+ for span in ctx.recorded_spans(DRAFT_CREATE_METHOD)
219
+ if isinstance(span.output, dict) and span.output.get("id")
220
+ }
190
221
  by_credential: dict[str | None, dict[str, Any]] = {}
191
222
  for name in (
192
223
  GET_METHOD,
@@ -195,6 +226,8 @@ def mailbox_from_recorded_calls(ctx: SandboxStartCtx) -> dict[str, Any]:
195
226
  LABELS_LIST_METHOD,
196
227
  LABEL_GET_METHOD,
197
228
  SEND_AS_LIST_METHOD,
229
+ DRAFT_GET_METHOD,
230
+ DRAFT_LIST_METHOD,
198
231
  ):
199
232
  for span in ctx.recorded_spans(name):
200
233
  output = span.output
@@ -208,6 +241,7 @@ def mailbox_from_recorded_calls(ctx: SandboxStartCtx) -> dict[str, Any]:
208
241
  "credential": credential,
209
242
  "emailAddress": None,
210
243
  "messages": {},
244
+ "drafts": {},
211
245
  "searches": [],
212
246
  "labels": {},
213
247
  "sendAs": None,
@@ -233,11 +267,23 @@ def mailbox_from_recorded_calls(ctx: SandboxStartCtx) -> dict[str, Any]:
233
267
  _keep_user_label(box["labels"], output)
234
268
  if name == SEND_AS_LIST_METHOD and isinstance(output.get("sendAs"), list):
235
269
  box["sendAs"] = output["sendAs"]
270
+ drafts = (
271
+ [output]
272
+ if name == DRAFT_GET_METHOD
273
+ else output.get("drafts") or []
274
+ if name == DRAFT_LIST_METHOD
275
+ else []
276
+ )
277
+ for draft in drafts:
278
+ draft_id = str(draft.get("id") or "")
279
+ if draft_id and draft_id not in created:
280
+ box["drafts"].setdefault(draft_id, draft)
236
281
  boxes = [
237
282
  {
238
283
  **box,
239
284
  "messages": list(box["messages"].values()),
240
285
  "labels": list(box["labels"].values()),
286
+ "drafts": list(box["drafts"].values()),
241
287
  }
242
288
  for box in by_credential.values()
243
289
  ]
@@ -307,6 +353,12 @@ def new_mailbox(
307
353
  send_as: list[dict[str, Any]] | None = None,
308
354
  ) -> dict[str, Any]:
309
355
  normalized = [gmail_message(message) for message in messages or []]
356
+ notes: list[str] = []
357
+ started_drafts = [
358
+ _start_draft(draft, position, normalized, notes)
359
+ for position, draft in enumerate(drafts or [])
360
+ if isinstance(draft, dict)
361
+ ]
310
362
  for message in normalized:
311
363
  if (
312
364
  message.get("payload")
@@ -329,11 +381,11 @@ def new_mailbox(
329
381
  "historyId": 1000,
330
382
  "nextId": index * 1_000_000 + 1,
331
383
  "messages": normalized,
332
- "drafts": list(drafts or []),
384
+ "drafts": started_drafts,
333
385
  "searches": list(searches or []),
334
386
  "labels": [_user_label(label) for label in labels or []],
335
387
  "sendAs": None if send_as is None else [dict(entry) for entry in send_as],
336
- "notes": [],
388
+ "notes": notes,
337
389
  }
338
390
 
339
391
 
@@ -350,6 +402,60 @@ def _user_label(label: dict[str, Any] | str) -> dict[str, Any]:
350
402
  }
351
403
 
352
404
 
405
+ def _draft_label(labels: Any) -> list[str]:
406
+ kept = [label for label in labels or [] if label != "DRAFT"]
407
+ return ["DRAFT", *kept]
408
+
409
+
410
+ def _draft_ref(message: dict[str, Any]) -> dict[str, Any]:
411
+ return {
412
+ "id": message["id"],
413
+ "threadId": message.get("threadId"),
414
+ "labelIds": message.get("labelIds"),
415
+ }
416
+
417
+
418
+ def _start_draft(
419
+ draft: dict[str, Any],
420
+ position: int,
421
+ messages: list[dict[str, Any]],
422
+ notes: list[str],
423
+ ) -> dict[str, Any]:
424
+ draft_id = str(draft.get("id") or f"r-start{position}")
425
+ given = dict(draft.get("message") or {})
426
+ message_id = str(given.get("id") or f"m-{draft_id}")
427
+ if given.get("raw") and "payload" not in given:
428
+ given = {**given, **_fields_from_raw(given.pop("raw"))}
429
+ existing = next((m for m in messages if m.get("id") == message_id), None)
430
+ carries_content = bool(set(given) - {"id", "threadId", "labelIds", "historyId"})
431
+ if carries_content:
432
+ built = gmail_message({"labelIds": ["DRAFT"], **given, "id": message_id})
433
+ message = _richer(existing, built) if existing else built
434
+ elif existing is not None:
435
+ message = existing
436
+ else:
437
+ message = gmail_message(
438
+ {
439
+ "id": message_id,
440
+ "threadId": given.get("threadId"),
441
+ "labelIds": ["DRAFT"],
442
+ "body": "",
443
+ }
444
+ )
445
+ message["labelIds"] = _draft_label(
446
+ message.get("labelIds") if given.get("labelIds") is None else given["labelIds"]
447
+ )
448
+ if not _body_text(message.get("payload") or {}) and not message.get("snippet"):
449
+ notes.append(
450
+ f"draft {draft_id} was never read in full in the original run, so its message is empty"
451
+ )
452
+ if existing is None:
453
+ messages.append(message)
454
+ elif message is not existing:
455
+ messages[messages.index(existing)] = message
456
+ return {"id": draft_id, "message": _draft_ref(message)}
457
+
458
+
353
459
  def _note(state: dict[str, Any], text: str) -> None:
354
460
  notes = state.setdefault("notes", [])
355
461
  if text not in notes:
@@ -685,27 +791,12 @@ def _bump_history(state: dict[str, Any]) -> str:
685
791
  def _from_raw(
686
792
  state: dict[str, Any], raw: str | None, thread_id: str | None, labels: list[str]
687
793
  ) -> dict[str, Any]:
688
- parsed = email.message_from_string(
689
- _unb64(raw) if raw else "", policy=email.policy.default
690
- )
691
- body_part = (
692
- parsed.get_body(preferencelist=("plain", "html"))
693
- if parsed.is_multipart()
694
- else parsed
695
- )
696
- body = body_part.get_content() if body_part is not None else ""
697
- fields = {
698
- key: parsed.get(header)
699
- for key, header in _PLAIN_HEADERS.items()
700
- if parsed.get(header)
701
- }
702
794
  message_id = _next_id(state, "sandbox")
703
795
  message = gmail_message(
704
796
  {
705
- **fields,
797
+ **_fields_from_raw(raw),
706
798
  "id": message_id,
707
799
  "threadId": thread_id or message_id,
708
- "body": str(body),
709
800
  "labelIds": labels,
710
801
  "internalDate": _clock_millis(state),
711
802
  }
@@ -726,31 +817,87 @@ def _send(state: dict[str, Any], params: dict[str, Any]) -> dict[str, Any]:
726
817
  }
727
818
 
728
819
 
820
+ def _bad_request(text: str) -> dict[str, Any]:
821
+ return {
822
+ HTTP_ERROR_KEY: {
823
+ "code": 400,
824
+ "message": text,
825
+ "status": "INVALID_ARGUMENT",
826
+ "errors": [
827
+ {"message": text, "domain": "global", "reason": "invalidArgument"}
828
+ ],
829
+ }
830
+ }
831
+
832
+
833
+ def _find_draft(state: dict[str, Any], draft_id: Any) -> dict[str, Any] | None:
834
+ return next((d for d in state["drafts"] if d.get("id") == draft_id), None)
835
+
836
+
837
+ def _new_draft_message(
838
+ state: dict[str, Any], inner: dict[str, Any], thread_id: str | None
839
+ ) -> dict[str, Any]:
840
+ message = _from_raw(
841
+ state, inner.get("raw"), inner.get("threadId") or thread_id, ["DRAFT"]
842
+ )
843
+ state["messages"].append(message)
844
+ return message
845
+
846
+
729
847
  def _draft_create(state: dict[str, Any], params: dict[str, Any]) -> dict[str, Any]:
730
848
  inner = (params.get("body") or {}).get("message") or {}
731
- message = _from_raw(state, inner.get("raw"), inner.get("threadId"), ["DRAFT"])
732
- state["messages"].append(message)
733
- draft = {
734
- "id": _next_id(state, "r-sandbox"),
735
- "message": {
736
- "id": message["id"],
737
- "threadId": message["threadId"],
738
- "labelIds": ["DRAFT"],
739
- },
740
- }
849
+ message = _new_draft_message(state, inner, None)
850
+ draft = {"id": _next_id(state, "r-sandbox"), "message": _draft_ref(message)}
741
851
  state["drafts"].append(draft)
742
- return draft
852
+ return copy.deepcopy(draft)
743
853
 
744
854
 
745
- def _draft_send(state: dict[str, Any], params: dict[str, Any]) -> dict[str, Any]:
746
- draft_id = (params.get("body") or {}).get("id")
747
- draft = next((d for d in state["drafts"] if d.get("id") == draft_id), None)
855
+ def _draft_get(state: dict[str, Any], params: dict[str, Any]) -> dict[str, Any]:
856
+ draft = _find_draft(state, params.get("id"))
748
857
  if draft is None:
749
- return _not_found(f"draft {draft_id}")
750
- state["drafts"].remove(draft)
858
+ return _not_found(f"draft {params.get('id')}")
751
859
  message = _find(state, draft["message"]["id"])
752
860
  if message is None:
753
861
  return _not_found(f"message {draft['message']['id']}")
862
+ fmt = str(params.get("format") or "full").lower()
863
+ return {"id": draft["id"], "message": _shaped(message, fmt, None)}
864
+
865
+
866
+ def _replace_draft_message(
867
+ state: dict[str, Any], draft: dict[str, Any], inner: dict[str, Any]
868
+ ) -> None:
869
+ old = _find(state, draft["message"]["id"])
870
+ if old is not None:
871
+ state["messages"].remove(old)
872
+ message = _new_draft_message(
873
+ state, inner, (old or draft["message"]).get("threadId")
874
+ )
875
+ draft["message"] = _draft_ref(message)
876
+
877
+
878
+ def _draft_update(state: dict[str, Any], params: dict[str, Any]) -> dict[str, Any]:
879
+ draft = _find_draft(state, params.get("id"))
880
+ if draft is None:
881
+ return _not_found(f"draft {params.get('id')}")
882
+ inner = (params.get("body") or {}).get("message") or {}
883
+ if not inner.get("raw"):
884
+ return _bad_request("Missing draft message")
885
+ _replace_draft_message(state, draft, inner)
886
+ return copy.deepcopy(draft)
887
+
888
+
889
+ def _draft_delete(state: dict[str, Any], params: dict[str, Any]) -> dict[str, Any]:
890
+ draft = _find_draft(state, params.get("id"))
891
+ if draft is None:
892
+ return _not_found(f"draft {params.get('id')}")
893
+ state["drafts"].remove(draft)
894
+ message = _find(state, draft["message"]["id"])
895
+ if message is not None:
896
+ state["messages"].remove(message)
897
+ return {}
898
+
899
+
900
+ def _mark_sent(state: dict[str, Any], message: dict[str, Any]) -> dict[str, Any]:
754
901
  message["labelIds"] = [
755
902
  label for label in message.get("labelIds") or [] if label != "DRAFT"
756
903
  ] + ["SENT"]
@@ -762,6 +909,26 @@ def _draft_send(state: dict[str, Any], params: dict[str, Any]) -> dict[str, Any]
762
909
  }
763
910
 
764
911
 
912
+ def _draft_send(state: dict[str, Any], params: dict[str, Any]) -> dict[str, Any]:
913
+ body = params.get("body") or {}
914
+ inner = body.get("message") or {}
915
+ draft_id = body.get("id")
916
+ if draft_id is None:
917
+ if not inner.get("raw"):
918
+ return _bad_request("Missing draft id or message")
919
+ return _mark_sent(state, _new_draft_message(state, inner, None))
920
+ draft = _find_draft(state, draft_id)
921
+ if draft is None:
922
+ return _not_found(f"draft {draft_id}")
923
+ if inner.get("raw"):
924
+ _replace_draft_message(state, draft, inner)
925
+ state["drafts"].remove(draft)
926
+ message = _find(state, draft["message"]["id"])
927
+ if message is None:
928
+ return _not_found(f"message {draft['message']['id']}")
929
+ return _mark_sent(state, message)
930
+
931
+
765
932
  def _modify(state: dict[str, Any], params: dict[str, Any]) -> dict[str, Any]:
766
933
  message = _find(state, str(params.get("id")))
767
934
  if message is None:
@@ -967,9 +1134,12 @@ HANDLERS: dict[str, Callable[[dict[str, Any], dict[str, Any]], dict[str, Any]]]
967
1134
  "gmail.users.messages.send": _send,
968
1135
  "gmail.users.messages.modify": _modify,
969
1136
  "gmail.users.messages.attachments.get": _attachment,
970
- "gmail.users.drafts.create": _draft_create,
1137
+ DRAFT_CREATE_METHOD: _draft_create,
1138
+ DRAFT_GET_METHOD: _draft_get,
1139
+ "gmail.users.drafts.update": _draft_update,
1140
+ "gmail.users.drafts.delete": _draft_delete,
971
1141
  "gmail.users.drafts.send": _draft_send,
972
- "gmail.users.drafts.list": _drafts_list,
1142
+ DRAFT_LIST_METHOD: _drafts_list,
973
1143
  "gmail.users.threads.get": _thread,
974
1144
  "gmail.users.history.list": _history,
975
1145
  LABELS_LIST_METHOD: _labels,
@@ -1095,7 +1265,10 @@ def gmail_sandbox(
1095
1265
  signature.
1096
1266
  Each message is a Gmail API message or plain fields as
1097
1267
  ``gmail_message`` takes them; a plain ``account`` field puts the
1098
- message in that account's mailbox. For several accounts, return
1268
+ message in that account's mailbox. Each draft is
1269
+ ``{"id": ..., "message": ...}``, where the message is a Gmail API
1270
+ message (as ``drafts.get`` returns it, ``raw`` included), plain
1271
+ fields, or only the ``id`` of a message in ``messages``. For several accounts, return
1099
1272
  ``{"mailboxes": [{"emailAddress": ..., "messages": [...]}]}``.
1100
1273
  ``None`` uses ``mailbox_from_recorded_calls``.
1101
1274
  account: With several mailboxes, names the account a call is for
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "bitfab-py"
3
- version = "0.78.2"
3
+ version = "0.78.3"
4
4
  description = "Bitfab client for provider-based API calls with local BAML execution"
5
5
  authors = ["Harvest Team"]
6
6
  readme = "README.md"
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