spawnllm 0.17.6__tar.gz → 0.17.8__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 (35) hide show
  1. {spawnllm-0.17.6 → spawnllm-0.17.8}/PKG-INFO +2 -2
  2. {spawnllm-0.17.6 → spawnllm-0.17.8}/README.md +1 -1
  3. {spawnllm-0.17.6 → spawnllm-0.17.8}/pyproject.toml +1 -1
  4. {spawnllm-0.17.6 → spawnllm-0.17.8}/pyproject.toml.orig +1 -1
  5. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/_core/spawnllm_core.wasm +0 -0
  6. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/backends/claude.py +16 -0
  7. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/backends/claude_sdk.py +5 -2
  8. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/cli.py +74 -1
  9. {spawnllm-0.17.6 → spawnllm-0.17.8}/LICENSE +0 -0
  10. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/__init__.py +0 -0
  11. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/__main__.py +0 -0
  12. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/_core/__init__.py +0 -0
  13. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/backends/__init__.py +0 -0
  14. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/backends/apple.py +0 -0
  15. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/backends/base.py +0 -0
  16. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/backends/codex.py +0 -0
  17. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/backends/gemini.py +0 -0
  18. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/backends/mlx.py +0 -0
  19. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/backends/openai_endpoint.py +0 -0
  20. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/backends/registry.py +0 -0
  21. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/call.py +0 -0
  22. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/decide.py +0 -0
  23. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/extract.py +0 -0
  24. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/mlx/__init__.py +0 -0
  25. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/mlx/codec.py +0 -0
  26. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/mlx/engine.py +0 -0
  27. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/mlx/fuse.py +0 -0
  28. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/mlx/patches.py +0 -0
  29. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/proc.py +0 -0
  30. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/py.typed +0 -0
  31. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/response.py +0 -0
  32. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/run.py +0 -0
  33. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/spec.py +0 -0
  34. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/structured.py +0 -0
  35. {spawnllm-0.17.6 → spawnllm-0.17.8}/spawnllm/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spawnllm
3
- Version: 0.17.6
3
+ Version: 0.17.8
4
4
  Summary: Delete your subprocess wrappers around claude, codex, and gemini.
5
5
  Keywords:
6
6
  Author: Yasyf Mohamedali
@@ -194,7 +194,7 @@ Both expose `Call`/`call` and typed `Extract`/`extract` against your existing CL
194
194
  - **Decisions** — every question and answer type, the provider pins, and the retry and key-lookup rules — [Deciding reference](https://yasyf.github.io/spawnllm/reference/#deciding)
195
195
  - **Backend selection** — the priority chain, plus `specialty=` routing (`debugging` and `review` go to Codex, `general` to the Claude Agent SDK backend) — [Backends reference](https://yasyf.github.io/spawnllm/reference/#backends)
196
196
  - **Transport helpers** — `run_cli`, `collect_process`, and `map_concurrent`, the subprocess plumbing shared by every CLI backend — [Transport reference](https://yasyf.github.io/spawnllm/reference/#transport)
197
- - **The CLI** — `spawnllm call`, `status`, `backends`, and `key set` from any shell — [CLI reference](https://yasyf.github.io/spawnllm/reference/cli/)
197
+ - **The CLI** — `spawnllm call`, `decide`, `status`, `backends`, and `key set` from any shell — [CLI reference](https://yasyf.github.io/spawnllm/reference/cli/)
198
198
  - **MLX internals** — the adapter codec, fuser, and runtime patches behind the local engine — [MLX reference](https://yasyf.github.io/spawnllm/reference/#mlx)
199
199
 
200
200
  Read the [docs](https://yasyf.github.io/spawnllm/) for the full guide and API reference. Licensed under [MIT](https://github.com/yasyf/spawnllm/blob/main/LICENSE).
@@ -142,7 +142,7 @@ Both expose `Call`/`call` and typed `Extract`/`extract` against your existing CL
142
142
  - **Decisions** — every question and answer type, the provider pins, and the retry and key-lookup rules — [Deciding reference](https://yasyf.github.io/spawnllm/reference/#deciding)
143
143
  - **Backend selection** — the priority chain, plus `specialty=` routing (`debugging` and `review` go to Codex, `general` to the Claude Agent SDK backend) — [Backends reference](https://yasyf.github.io/spawnllm/reference/#backends)
144
144
  - **Transport helpers** — `run_cli`, `collect_process`, and `map_concurrent`, the subprocess plumbing shared by every CLI backend — [Transport reference](https://yasyf.github.io/spawnllm/reference/#transport)
145
- - **The CLI** — `spawnllm call`, `status`, `backends`, and `key set` from any shell — [CLI reference](https://yasyf.github.io/spawnllm/reference/cli/)
145
+ - **The CLI** — `spawnllm call`, `decide`, `status`, `backends`, and `key set` from any shell — [CLI reference](https://yasyf.github.io/spawnllm/reference/cli/)
146
146
  - **MLX internals** — the adapter codec, fuser, and runtime patches behind the local engine — [MLX reference](https://yasyf.github.io/spawnllm/reference/#mlx)
147
147
 
148
148
  Read the [docs](https://yasyf.github.io/spawnllm/) for the full guide and API reference. Licensed under [MIT](https://github.com/yasyf/spawnllm/blob/main/LICENSE).
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "spawnllm"
3
- version = "0.17.6"
3
+ version = "0.17.8"
4
4
  description = "Delete your subprocess wrappers around claude, codex, and gemini."
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "spawnllm"
3
3
  # Inert sentinel: the real version is set from the release tag (uv version --frozen).
4
- version = "0.17.6"
4
+ version = "0.17.8"
5
5
  description = "Delete your subprocess wrappers around claude, codex, and gemini."
6
6
  readme = "README.md"
7
7
  license = "MIT"
@@ -68,6 +68,22 @@ class ClaudeCliBackend(CliBackend):
68
68
  _api_config_dir: str | None = None
69
69
  _rejected_tokens: frozenset[str] = frozenset()
70
70
 
71
+ @staticmethod
72
+ def light_env() -> dict[str, str]:
73
+ """Return the env every planned `claude` run carries to start light.
74
+
75
+ It turns off the plugin and CLI auto-updater, telemetry, error reporting,
76
+ IDE auto-connect, claude.ai MCP connectors, bundled skills, file
77
+ checkpointing, and the native file watchers a headless run never needs.
78
+ A caller launching `claude` itself merges it into the child env; a
79
+ `RunSpec.env` entry overrides any of it.
80
+
81
+ Example:
82
+ >>> ClaudeCliBackend.light_env()["DISABLE_AUTOUPDATER"]
83
+ '1'
84
+ """
85
+ return _core.dispatch("capabilities")["claude_light_env"]
86
+
71
87
  def claude_isolation(self, api_auth: bool) -> ClaudeIsolation:
72
88
  """Return the isolation for one run: the process-lifetime config home and the env resolved now.
73
89
 
@@ -21,7 +21,7 @@ from spawnllm.backends.base import (
21
21
  BackendReady,
22
22
  LlmBackend,
23
23
  )
24
- from spawnllm.backends.claude import CLAUDE_MODELS
24
+ from spawnllm.backends.claude import CLAUDE_MODELS, ClaudeCliBackend
25
25
  from spawnllm.response import Error, Output, Response, Result
26
26
  from spawnllm.spec import ClaudeConfig
27
27
 
@@ -57,6 +57,7 @@ class ClaudeSdkBackend(LlmBackend):
57
57
  `["project"]`, matching the CLI plan, until `ClaudeConfig.setting_sources`
58
58
  names its own.
59
59
 
60
+ Every run carries `ClaudeCliBackend.light_env()`, and
60
61
  `api_auth=False` blanks Claude's API-key environment variables because the
61
62
  SDK can only overlay its subprocess environment, not truly unset inherited
62
63
  keys. An explicit `RunSpec.env` value still wins. `ClaudeConfig.mcp_config`
@@ -96,7 +97,9 @@ class ClaudeSdkBackend(LlmBackend):
96
97
  options = ClaudeAgentOptions(
97
98
  model=spec.model,
98
99
  cwd=spec.cwd,
99
- env=({} if spec.api_auth else {key: "" for key in api_key_vars}) | (spec.env or {}),
100
+ env=ClaudeCliBackend.light_env()
101
+ | ({} if spec.api_auth else {key: "" for key in api_key_vars})
102
+ | (spec.env or {}),
100
103
  setting_sources=host_free if cfg.setting_sources is None else list(cfg.setting_sources),
101
104
  strict_mcp_config=spec.isolated or cfg.strict_mcp,
102
105
  max_turns=cfg.max_turns,
@@ -1,7 +1,10 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import dataclasses
4
+ import json
3
5
  import subprocess
4
6
  import sys
7
+ from typing import Any
5
8
 
6
9
  import click
7
10
  from loguru import logger
@@ -15,10 +18,35 @@ from spawnllm.backends import (
15
18
  )
16
19
  from spawnllm.backends.registry import BACKENDS_BY_NAME, PRIORITY, select_backend
17
20
  from spawnllm.call import DEFAULT_MODEL, call_sync
18
- from spawnllm.decide import JEV, OPENAI, Provider, store_key
21
+ from spawnllm.decide import (
22
+ DEFAULT_TIMEOUT,
23
+ JEV,
24
+ OPENAI,
25
+ Answer,
26
+ Binary,
27
+ BinaryAnswer,
28
+ DecideError,
29
+ DecideKeyMissing,
30
+ Label,
31
+ LabelAnswer,
32
+ Provider,
33
+ Question,
34
+ Refused,
35
+ Score,
36
+ ScoreAnswer,
37
+ decide_sync,
38
+ store_key,
39
+ )
19
40
 
20
41
  BACKEND_NAMES = tuple(BACKENDS_BY_NAME)
21
42
  DECIDE_PROVIDERS: dict[str, Provider] = {provider.name: provider for provider in (JEV, OPENAI)}
43
+ QUESTION_TYPES: dict[str, type[Binary | Label | Score]] = {"binary": Binary, "label": Label, "score": Score}
44
+ ANSWER_TYPES: dict[type[Answer], str] = {
45
+ BinaryAnswer: "binary",
46
+ LabelAnswer: "label",
47
+ ScoreAnswer: "score",
48
+ Refused: "refused",
49
+ }
22
50
 
23
51
 
24
52
  @click.group()
@@ -73,6 +101,51 @@ def status() -> None:
73
101
  click.echo(f"core: {(v := _core.version())['core_version']}@{v['source_hash'][:12]}")
74
102
 
75
103
 
104
+ @main.command("decide")
105
+ @click.option("--provider", type=click.Choice(list(DECIDE_PROVIDERS)), default=JEV.name, show_default=True)
106
+ @click.option(
107
+ "--timeout",
108
+ type=float,
109
+ default=DEFAULT_TIMEOUT,
110
+ show_default=True,
111
+ help="Seconds for the whole call, retries included.",
112
+ )
113
+ def decide_questions(provider: str, timeout: float) -> None:
114
+ """Ask the questions a JSON object on stdin holds about its state, and print the answers as JSON.
115
+
116
+ The object holds `state`, the text or JSON to judge, and `questions`, each id mapped to
117
+ `{"binary": {...}}`, `{"label": {...}}` or `{"score": {...}}` holding that question's fields,
118
+ such as `{"label": {"instructions": "...", "options": {"none": "...", "a1": null}}}`. It prints
119
+ `{"model": ..., "answers": {<id>: {"type": "label", "choice": ..., "probabilities": {...}, "confidence": ...}}}`.
120
+ """
121
+ try:
122
+ request = json.loads(sys.stdin.read())
123
+ questions = {id: question(spec) for id, spec in request["questions"].items()}
124
+ decision = decide_sync(request["state"], questions, provider=DECIDE_PROVIDERS[provider], timeout=timeout)
125
+ except (
126
+ json.JSONDecodeError,
127
+ KeyError,
128
+ TypeError,
129
+ ValueError,
130
+ TimeoutError,
131
+ DecideError,
132
+ DecideKeyMissing,
133
+ ) as error:
134
+ raise click.ClickException(str(error)) from error
135
+ answers = {
136
+ id: {"type": ANSWER_TYPES[type(answer)], **dataclasses.asdict(answer)}
137
+ for id, answer in decision.answers.items()
138
+ }
139
+ click.echo(json.dumps({"model": decision.model, "answers": answers}))
140
+
141
+
142
+ def question(spec: dict[str, Any]) -> Question:
143
+ [(kind, fields)] = spec.items()
144
+ if kind not in QUESTION_TYPES:
145
+ raise ValueError(f"unknown question type {kind!r}: use {', '.join(QUESTION_TYPES)}")
146
+ return QUESTION_TYPES[kind](**fields)
147
+
148
+
76
149
  @main.group()
77
150
  def key() -> None:
78
151
  """Manage the decision providers' API keys in the macOS Keychain."""
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