deepparallel 0.5.0__tar.gz → 0.5.2__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.
- {deepparallel-0.5.0 → deepparallel-0.5.2}/PKG-INFO +1 -1
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/__init__.py +1 -1
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/agent.py +33 -1
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/backend.py +137 -37
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/cli.py +7 -5
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/config.py +28 -4
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/serve.py +27 -5
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/supply_chain.py +19 -8
- deepparallel-0.5.2/deepparallel/system_prompt.txt +14 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/tools/mcp.py +52 -27
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/tools/web.py +9 -3
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel.egg-info/PKG-INFO +1 -1
- {deepparallel-0.5.0 → deepparallel-0.5.2}/pyproject.toml +1 -1
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_supply_chain.py +18 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_tools_mcp.py +35 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_tools_web.py +15 -0
- deepparallel-0.5.0/deepparallel/system_prompt.txt +0 -7
- {deepparallel-0.5.0 → deepparallel-0.5.2}/README.md +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/branding.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/crowe_id.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/dsml.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/fusion.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/licensing.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/registry.json +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/renderer.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/research/__init__.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/research/conduit.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/research/provider.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/routing.example.json +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/routing.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/tools/__init__.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/tools/codeast.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/tools/edit.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/tools/files.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/tools/registry.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/tools/sandbox.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/tools/search.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/tools/shell.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/tools/vision.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel/userinput.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel.egg-info/SOURCES.txt +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel.egg-info/dependency_links.txt +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel.egg-info/entry_points.txt +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel.egg-info/requires.txt +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/deepparallel.egg-info/top_level.txt +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/setup.cfg +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_agent.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_backend.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_backend_chat.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_backend_stream.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_branding.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_cli.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_config.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_crowe_backend.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_crowe_gateway_backend.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_crowe_id_auth.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_crowe_payment_required.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_dsml.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_fusion.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_issuer_signer.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_licensing.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_renderer.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_research.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_research_provider.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_routing.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_serve.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_spinner_color.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_tool_registry.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_tools_codeast.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_tools_edit.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_tools_files.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_tools_sandbox.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_tools_search.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_tools_shell.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_tools_vision.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_userinput.py +0 -0
- {deepparallel-0.5.0 → deepparallel-0.5.2}/tests/test_userinput_paste.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deepparallel
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: DeepParallel - a multi-model agentic coding CLI with cross-model Guardian review, served via Crowe Logic.
|
|
5
5
|
Author-email: Michael Crowe <michael@crowelogic.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -204,6 +204,38 @@ def _guardian_verdict(guardian, name: str, args: dict) -> str | None:
|
|
|
204
204
|
return guardian_review(guardian, _guardian_review_content(name, args))
|
|
205
205
|
|
|
206
206
|
|
|
207
|
+
def _local_module_names(target_path: str) -> set[str]:
|
|
208
|
+
"""Module names that resolve to files in the workspace, so a sibling import
|
|
209
|
+
like `from compound_library import ...` is never flagged as a hallucinated
|
|
210
|
+
PyPI package. Scans the target file's directory and the cwd (capped)."""
|
|
211
|
+
names: set[str] = set()
|
|
212
|
+
roots = []
|
|
213
|
+
try:
|
|
214
|
+
roots.append(Path(target_path).expanduser().resolve().parent)
|
|
215
|
+
except Exception: # noqa: BLE001
|
|
216
|
+
pass
|
|
217
|
+
try:
|
|
218
|
+
roots.append(Path.cwd().resolve())
|
|
219
|
+
except Exception: # noqa: BLE001
|
|
220
|
+
pass
|
|
221
|
+
seen_roots: set[Path] = set()
|
|
222
|
+
for root in roots:
|
|
223
|
+
if root in seen_roots:
|
|
224
|
+
continue
|
|
225
|
+
seen_roots.add(root)
|
|
226
|
+
try:
|
|
227
|
+
for i, p in enumerate(root.rglob("*.py")):
|
|
228
|
+
names.add(p.stem)
|
|
229
|
+
if p.name == "__init__.py":
|
|
230
|
+
names.add(p.parent.name)
|
|
231
|
+
if i >= 5000:
|
|
232
|
+
break
|
|
233
|
+
except Exception: # noqa: BLE001
|
|
234
|
+
pass
|
|
235
|
+
names.discard("__init__")
|
|
236
|
+
return names
|
|
237
|
+
|
|
238
|
+
|
|
207
239
|
def _supply_chain_note(name: str, args: dict) -> str | None:
|
|
208
240
|
"""Best-effort: flag hallucinated/slopsquatted deps an edit introduces."""
|
|
209
241
|
content = args.get("new_source") or args.get("new_string") or args.get("content") or ""
|
|
@@ -213,7 +245,7 @@ def _supply_chain_note(name: str, args: dict) -> str | None:
|
|
|
213
245
|
try:
|
|
214
246
|
from deepparallel import supply_chain
|
|
215
247
|
|
|
216
|
-
result = supply_chain.audit(content, path)
|
|
248
|
+
result = supply_chain.audit(content, path, _local_module_names(path))
|
|
217
249
|
except Exception: # noqa: BLE001 - supply-chain check is best-effort
|
|
218
250
|
return None
|
|
219
251
|
if result["hallucinated"]:
|
|
@@ -11,6 +11,8 @@ stream_chat yields (channel, text) tuples where channel is "content" or
|
|
|
11
11
|
from __future__ import annotations
|
|
12
12
|
|
|
13
13
|
import json
|
|
14
|
+
import os
|
|
15
|
+
import sys
|
|
14
16
|
from typing import Iterator, Protocol
|
|
15
17
|
from urllib.parse import urlparse
|
|
16
18
|
|
|
@@ -142,6 +144,24 @@ class Backend(Protocol):
|
|
|
142
144
|
) -> Iterator[Chunk]: ...
|
|
143
145
|
|
|
144
146
|
|
|
147
|
+
def _should_failover(exc: Exception) -> bool:
|
|
148
|
+
"""Fail over to direct Azure only on transport errors or upstream 5xx;
|
|
149
|
+
a 4xx means the request itself is bad, so retrying elsewhere is pointless."""
|
|
150
|
+
if isinstance(exc, httpx.TransportError):
|
|
151
|
+
return True
|
|
152
|
+
if isinstance(exc, httpx.HTTPStatusError):
|
|
153
|
+
return exc.response.status_code >= 500
|
|
154
|
+
return False
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def _log_failover(label: str, exc: Exception) -> None:
|
|
158
|
+
sys.stderr.write(
|
|
159
|
+
f"[deepparallel] {label}: primary endpoint failed "
|
|
160
|
+
f"({exc.__class__.__name__}); failing over to direct Azure\n"
|
|
161
|
+
)
|
|
162
|
+
sys.stderr.flush()
|
|
163
|
+
|
|
164
|
+
|
|
145
165
|
class AzureBackend:
|
|
146
166
|
label = "Azure OpenAI"
|
|
147
167
|
|
|
@@ -151,13 +171,56 @@ class AzureBackend:
|
|
|
151
171
|
self._deployment = deployment
|
|
152
172
|
self._api_version = api_version
|
|
153
173
|
|
|
154
|
-
|
|
155
|
-
|
|
174
|
+
def _build_url(self, endpoint: str) -> str:
|
|
175
|
+
# Cloudflare AI Gateway azure-openai routes carry the resource in the
|
|
176
|
+
# path and drop the native "/openai/deployments" segment; native Azure
|
|
177
|
+
# endpoints keep it.
|
|
178
|
+
endpoint = endpoint.rstrip("/")
|
|
179
|
+
if "/azure-openai/" in endpoint:
|
|
180
|
+
return (
|
|
181
|
+
f"{endpoint}/{self._deployment}"
|
|
182
|
+
f"/chat/completions?api-version={self._api_version}"
|
|
183
|
+
)
|
|
156
184
|
return (
|
|
157
|
-
f"{
|
|
185
|
+
f"{endpoint}/openai/deployments/{self._deployment}"
|
|
158
186
|
f"/chat/completions?api-version={self._api_version}"
|
|
159
187
|
)
|
|
160
188
|
|
|
189
|
+
def _endpoints(self) -> list[str]:
|
|
190
|
+
# Primary is whatever is configured (typically the Cloudflare AI Gateway
|
|
191
|
+
# route). When that primary is a gateway route, derive the direct Azure
|
|
192
|
+
# endpoint from its resource segment and append it as automatic failover:
|
|
193
|
+
# fail-open, so a gateway outage degrades to direct Azure instead of
|
|
194
|
+
# taking down every CroweLM request. The failover request is not logged
|
|
195
|
+
# by the gateway -- the acceptable cost of staying available.
|
|
196
|
+
eps = [self._endpoint]
|
|
197
|
+
marker = "/azure-openai/"
|
|
198
|
+
if marker in self._endpoint:
|
|
199
|
+
resource = self._endpoint.split(marker, 1)[1].split("/", 1)[0]
|
|
200
|
+
if resource:
|
|
201
|
+
eps.append(f"https://{resource}.cognitiveservices.azure.com")
|
|
202
|
+
return eps
|
|
203
|
+
|
|
204
|
+
@property
|
|
205
|
+
def _url(self) -> str:
|
|
206
|
+
return self._build_url(self._endpoint)
|
|
207
|
+
|
|
208
|
+
@property
|
|
209
|
+
def _headers(self) -> dict:
|
|
210
|
+
# cf-aig-* headers configure AI Gateway per-request (no management API
|
|
211
|
+
# needed). Cache TTL is operationally tunable via DEEPPARALLEL_CACHE_TTL
|
|
212
|
+
# (seconds; "0" or empty disables caching for this agentic workload).
|
|
213
|
+
# Ignored by direct Azure on the failover path.
|
|
214
|
+
headers = {
|
|
215
|
+
"api-key": self._api_key,
|
|
216
|
+
"content-type": "application/json",
|
|
217
|
+
}
|
|
218
|
+
ttl = os.getenv("DEEPPARALLEL_CACHE_TTL", "300").strip()
|
|
219
|
+
if ttl and ttl != "0":
|
|
220
|
+
headers["cf-aig-cache-ttl"] = ttl
|
|
221
|
+
headers["cf-aig-metadata"] = '{"via":"deepparallel-gateway"}'
|
|
222
|
+
return headers
|
|
223
|
+
|
|
161
224
|
def check(self) -> tuple[bool, str]:
|
|
162
225
|
if not self._endpoint or not self._api_key:
|
|
163
226
|
return False, "Azure endpoint or API key not configured."
|
|
@@ -167,49 +230,86 @@ class AzureBackend:
|
|
|
167
230
|
return False, f"Azure endpoint unreachable ({e.__class__.__name__})"
|
|
168
231
|
return True, f"Azure @ {_host(self._endpoint)}"
|
|
169
232
|
|
|
233
|
+
def _payload(self, messages, stream, temperature, max_tokens) -> dict:
|
|
234
|
+
# GPT-5 family deployments require `max_completion_tokens` and reject a
|
|
235
|
+
# custom `temperature` (only the default is accepted) -> they 400 on the
|
|
236
|
+
# legacy `max_tokens`/`temperature` shape. Everything else uses the
|
|
237
|
+
# classic params.
|
|
238
|
+
payload = {"messages": messages, "stream": stream}
|
|
239
|
+
dep = self._deployment.lower()
|
|
240
|
+
if dep.startswith("gpt-5") or dep.startswith("gpt-chat"):
|
|
241
|
+
# GPT-5 family + gpt-chat-latest require max_completion_tokens and
|
|
242
|
+
# reject a custom temperature (only the default is accepted).
|
|
243
|
+
payload["max_completion_tokens"] = max_tokens
|
|
244
|
+
else:
|
|
245
|
+
payload["temperature"] = temperature
|
|
246
|
+
payload["max_tokens"] = max_tokens
|
|
247
|
+
return payload
|
|
248
|
+
|
|
170
249
|
def stream_chat(self, messages, temperature, max_tokens):
|
|
171
|
-
payload =
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
250
|
+
payload = self._payload(messages, True, temperature, max_tokens)
|
|
251
|
+
urls = [self._build_url(e) for e in self._endpoints()]
|
|
252
|
+
for i, url in enumerate(urls):
|
|
253
|
+
last = i == len(urls) - 1
|
|
254
|
+
started = False
|
|
255
|
+
try:
|
|
256
|
+
with httpx.stream(
|
|
257
|
+
"POST", url, json=payload, headers=self._headers, timeout=_STREAM_TIMEOUT
|
|
258
|
+
) as r:
|
|
259
|
+
r.raise_for_status()
|
|
260
|
+
for chunk in parse_sse_lines(r.iter_lines()):
|
|
261
|
+
started = True
|
|
262
|
+
yield chunk
|
|
263
|
+
return
|
|
264
|
+
except (httpx.TransportError, httpx.HTTPStatusError) as e:
|
|
265
|
+
if last or started or not _should_failover(e):
|
|
266
|
+
raise
|
|
267
|
+
_log_failover(self.label, e)
|
|
268
|
+
continue
|
|
183
269
|
|
|
184
270
|
def chat(self, messages, tools, temperature, max_tokens) -> dict:
|
|
185
|
-
payload =
|
|
186
|
-
"messages": messages,
|
|
187
|
-
"stream": False,
|
|
188
|
-
"temperature": temperature,
|
|
189
|
-
"max_tokens": max_tokens,
|
|
190
|
-
}
|
|
271
|
+
payload = self._payload(messages, False, temperature, max_tokens)
|
|
191
272
|
if tools:
|
|
192
273
|
payload["tools"] = tools
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
274
|
+
urls = [self._build_url(e) for e in self._endpoints()]
|
|
275
|
+
for i, url in enumerate(urls):
|
|
276
|
+
last = i == len(urls) - 1
|
|
277
|
+
try:
|
|
278
|
+
r = httpx.post(url, json=payload, headers=self._headers, timeout=_STREAM_TIMEOUT)
|
|
279
|
+
r.raise_for_status()
|
|
280
|
+
return _message_from_choice(r.json()["choices"][0])
|
|
281
|
+
except (httpx.TransportError, httpx.HTTPStatusError) as e:
|
|
282
|
+
if last or not _should_failover(e):
|
|
283
|
+
raise
|
|
284
|
+
_log_failover(self.label, e)
|
|
285
|
+
continue
|
|
197
286
|
|
|
198
287
|
def stream_chat_tools(self, messages, tools, temperature, max_tokens):
|
|
199
|
-
payload =
|
|
200
|
-
"messages": messages,
|
|
201
|
-
"stream": True,
|
|
202
|
-
"temperature": temperature,
|
|
203
|
-
"max_tokens": max_tokens,
|
|
204
|
-
}
|
|
288
|
+
payload = self._payload(messages, True, temperature, max_tokens)
|
|
205
289
|
if tools:
|
|
206
290
|
payload["tools"] = tools
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
291
|
+
urls = [self._build_url(e) for e in self._endpoints()]
|
|
292
|
+
for i, url in enumerate(urls):
|
|
293
|
+
last = i == len(urls) - 1
|
|
294
|
+
started = False
|
|
295
|
+
try:
|
|
296
|
+
with httpx.stream(
|
|
297
|
+
"POST", url, json=payload, headers=self._headers, timeout=_STREAM_TIMEOUT
|
|
298
|
+
) as r:
|
|
299
|
+
r.raise_for_status()
|
|
300
|
+
gen = parse_sse_stream(r.iter_lines())
|
|
301
|
+
while True:
|
|
302
|
+
try:
|
|
303
|
+
chunk = next(gen)
|
|
304
|
+
except StopIteration as stop:
|
|
305
|
+
return stop.value
|
|
306
|
+
started = True
|
|
307
|
+
yield chunk
|
|
308
|
+
except (httpx.TransportError, httpx.HTTPStatusError) as e:
|
|
309
|
+
if last or started or not _should_failover(e):
|
|
310
|
+
raise
|
|
311
|
+
_log_failover(self.label, e)
|
|
312
|
+
continue
|
|
213
313
|
|
|
214
314
|
|
|
215
315
|
class FoundryBackend:
|
|
@@ -495,13 +495,15 @@ def review(ctx: click.Context, as_diff: bool, path: str | None) -> None:
|
|
|
495
495
|
|
|
496
496
|
Reviews a file (PATH) or a unified diff (--diff, from stdin) with a second
|
|
497
497
|
model and prints a verdict. Exit code: 0 safe, 1 risky, 2 bug - so it can
|
|
498
|
-
gate a commit or PR.
|
|
498
|
+
gate a commit or PR. Free with your own key (DEEPPARALLEL_BACKEND=openai or
|
|
499
|
+
ollama); Pro unlocks the hosted Crowe Logic model stack.
|
|
499
500
|
"""
|
|
500
501
|
settings: Settings = ctx.obj["settings"]
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
502
|
+
if not settings.byok:
|
|
503
|
+
ok, msg = licensing.check_feature("review")
|
|
504
|
+
if not ok:
|
|
505
|
+
branding.error(msg)
|
|
506
|
+
sys.exit(3)
|
|
505
507
|
if as_diff:
|
|
506
508
|
content = sys.stdin.read()
|
|
507
509
|
elif path:
|
|
@@ -45,6 +45,10 @@ class Settings:
|
|
|
45
45
|
mycelium_key: str | None = None
|
|
46
46
|
mycelium_secret: str | None = None
|
|
47
47
|
mycelium_model: str = "Mcrowe1210/gemma-4-mycelium-e4b"
|
|
48
|
+
# True when the user brings their own key/model (openai/ollama/foundry):
|
|
49
|
+
# the FREE tier. review + the agent run unlicensed; only the Crowe-hosted
|
|
50
|
+
# stack (azure/crowe) is gated to Pro.
|
|
51
|
+
byok: bool = False
|
|
48
52
|
# Crowe ID agent identity (backend="crowe"): route through the Foundry gateway
|
|
49
53
|
# authenticated by a client_credentials token instead of a raw provider key.
|
|
50
54
|
gateway_url: str | None = None
|
|
@@ -102,17 +106,36 @@ def _int_env(name: str, default: int) -> int:
|
|
|
102
106
|
|
|
103
107
|
def resolve_settings() -> Settings:
|
|
104
108
|
backend = os.environ.get("DEEPPARALLEL_BACKEND", "azure").strip().lower()
|
|
105
|
-
if backend not in {"azure", "foundry", "crowe"}:
|
|
109
|
+
if backend not in {"azure", "foundry", "crowe", "openai", "ollama"}:
|
|
106
110
|
backend = "azure"
|
|
111
|
+
|
|
112
|
+
# BYOK (bring-your-own-key) backends are the FREE tier. "openai" and "ollama"
|
|
113
|
+
# are friendly aliases onto the OpenAI-compatible foundry transport with
|
|
114
|
+
# sensible defaults, so `dp` works with no Crowe account and no license.
|
|
115
|
+
foundry_base_url = os.environ.get("FOUNDRY_BASE_URL")
|
|
116
|
+
foundry_api_key = os.environ.get("FOUNDRY_API_KEY")
|
|
117
|
+
foundry_model = os.environ.get("DEEPPARALLEL_FOUNDRY_MODEL", "DeepSeek-V3-1")
|
|
118
|
+
if backend == "openai":
|
|
119
|
+
foundry_base_url = os.environ.get("OPENAI_BASE_URL", "https://api.openai.com")
|
|
120
|
+
foundry_api_key = os.environ.get("OPENAI_API_KEY") or foundry_api_key
|
|
121
|
+
foundry_model = os.environ.get("DEEPPARALLEL_MODEL", "gpt-4o-mini")
|
|
122
|
+
backend = "foundry"
|
|
123
|
+
elif backend == "ollama":
|
|
124
|
+
foundry_base_url = os.environ.get("OLLAMA_HOST", "http://localhost:11434")
|
|
125
|
+
foundry_api_key = foundry_api_key or "ollama"
|
|
126
|
+
foundry_model = os.environ.get("DEEPPARALLEL_MODEL", "llama3.1")
|
|
127
|
+
backend = "foundry"
|
|
128
|
+
byok = backend == "foundry"
|
|
129
|
+
|
|
107
130
|
return Settings(
|
|
108
131
|
backend=backend,
|
|
109
132
|
azure_endpoint=os.environ.get("AZURE_CORE_ENDPOINT"),
|
|
110
133
|
azure_api_key=os.environ.get("AZURE_CORE_API_KEY"),
|
|
111
134
|
deployment=os.environ.get("DEEPPARALLEL_DEPLOYMENT", "DeepSeek-V4-Pro"),
|
|
112
135
|
api_version=os.environ.get("DEEPPARALLEL_API_VERSION", "2024-08-01-preview"),
|
|
113
|
-
foundry_base_url=
|
|
114
|
-
foundry_api_key=
|
|
115
|
-
foundry_model=
|
|
136
|
+
foundry_base_url=foundry_base_url,
|
|
137
|
+
foundry_api_key=foundry_api_key,
|
|
138
|
+
foundry_model=foundry_model,
|
|
116
139
|
temperature=_float_env("DEEPPARALLEL_TEMPERATURE", 0.4),
|
|
117
140
|
max_tokens=_int_env("DEEPPARALLEL_MAX_TOKENS", 8192),
|
|
118
141
|
show_thinking=_bool_env("DEEPPARALLEL_THINK", False),
|
|
@@ -149,6 +172,7 @@ def resolve_settings() -> Settings:
|
|
|
149
172
|
crowe_id_client_id=os.environ.get("CROWE_ID_CLIENT_ID"),
|
|
150
173
|
crowe_id_client_secret=os.environ.get("CROWE_ID_CLIENT_SECRET"),
|
|
151
174
|
crowe_id_audience=os.environ.get("CROWE_ID_AUDIENCE"),
|
|
175
|
+
byok=byok,
|
|
152
176
|
)
|
|
153
177
|
|
|
154
178
|
|
|
@@ -51,16 +51,35 @@ _SCRUB: list[tuple[re.Pattern[str], str]] = [
|
|
|
51
51
|
# The listing must never leak raw deployment names; chat accepts either the
|
|
52
52
|
# alias or the raw name, so existing callers keep working.
|
|
53
53
|
_MODEL_ALIASES: dict[str, str] = {
|
|
54
|
+
# DeepSeek family
|
|
54
55
|
"crowelm-apex": "DeepSeek-V4-Pro",
|
|
55
56
|
"crowelm-reason": "DeepSeek-R1-0528",
|
|
56
57
|
"crowelm-flash": "DeepSeek-V4-Flash",
|
|
57
|
-
"crowelm-vector": "DeepSeek-V3
|
|
58
|
+
"crowelm-vector": "DeepSeek-V3-1",
|
|
59
|
+
# GPT family (Azure frontier)
|
|
60
|
+
"crowelm-zenith": "gpt-5.5",
|
|
61
|
+
# --- gpt-5.4 family back-burnered (de-prioritized) — uncomment to re-enable ---
|
|
62
|
+
# "crowelm-prime": "gpt-5.4",
|
|
63
|
+
# "crowelm-prime-mini": "gpt-5.4-mini",
|
|
64
|
+
# "crowelm-prime-nano": "gpt-5.4-nano",
|
|
65
|
+
"crowelm-chat": "gpt-chat-latest",
|
|
66
|
+
"crowelm-swift": "gpt-4o",
|
|
67
|
+
# Grok family
|
|
58
68
|
"crowelm-quasar": "grok-4-3",
|
|
59
69
|
"crowelm-quasar-fast": "grok-4-1-fast-reasoning",
|
|
60
|
-
"crowelm-
|
|
70
|
+
"crowelm-quasar-lite": "grok-4-1-fast-non-r",
|
|
71
|
+
"crowelm-quasar-max": "grok-4-20-reasoning",
|
|
72
|
+
# Kimi family
|
|
61
73
|
"crowelm-eclipse": "Kimi-K2-6",
|
|
74
|
+
"crowelm-eclipse-lite": "Kimi-K2.5",
|
|
75
|
+
# Llama family
|
|
62
76
|
"crowelm-titan": "Llama-3-3-70B",
|
|
63
|
-
"crowelm-
|
|
77
|
+
"crowelm-maverick": "Llama-4-Maverick",
|
|
78
|
+
"crowelm-scout": "Llama-4-Scout",
|
|
79
|
+
# Specialist tiers
|
|
80
|
+
"crowelm-herald": "Cohere-Command-A",
|
|
81
|
+
"crowelm-forge": "Codestral-2501",
|
|
82
|
+
"crowelm-router": "model-router",
|
|
64
83
|
# Free base tier: the sovereign Gemma 4 Mycelium model on Modal. Only listed
|
|
65
84
|
# in /v1/models when MODAL_MYCELIUM_ENDPOINT is configured (see below).
|
|
66
85
|
"crowelm-mycelium": "Mcrowe1210/gemma-4-mycelium-e4b",
|
|
@@ -174,8 +193,11 @@ def _models_payload(settings) -> dict:
|
|
|
174
193
|
# this gateway process. Never list raw deployment names; chat still accepts
|
|
175
194
|
# them for existing callers, but discovery should not advertise unknown
|
|
176
195
|
# deployments.
|
|
177
|
-
|
|
178
|
-
|
|
196
|
+
ids = [
|
|
197
|
+
alias
|
|
198
|
+
for alias, deployment in _MODEL_ALIASES.items()
|
|
199
|
+
if _deployment_available(deployment, settings)
|
|
200
|
+
]
|
|
179
201
|
created = int(time.time())
|
|
180
202
|
return {
|
|
181
203
|
"object": "list",
|
|
@@ -44,23 +44,30 @@ _IMPORT_RE = re.compile(r"^\s*(?:import\s+([a-zA-Z0-9_.]+)|from\s+([a-zA-Z0-9_.]
|
|
|
44
44
|
_REQ_RE = re.compile(r"^\s*([A-Za-z0-9][A-Za-z0-9._-]*)")
|
|
45
45
|
|
|
46
46
|
|
|
47
|
-
def extract_dependencies(
|
|
48
|
-
|
|
47
|
+
def extract_dependencies(
|
|
48
|
+
content: str, filename: str, local_modules: set[str] | None = None
|
|
49
|
+
) -> list[dict]:
|
|
50
|
+
"""Return [{name, ecosystem, raw}] introduced by this content.
|
|
51
|
+
|
|
52
|
+
`local_modules` names resolve to files in the workspace (sibling modules,
|
|
53
|
+
local packages) and are never treated as third-party dependencies.
|
|
54
|
+
"""
|
|
49
55
|
fn = filename.rsplit("/", 1)[-1].lower()
|
|
50
56
|
if fn == "package.json":
|
|
51
57
|
return _from_package_json(content)
|
|
52
58
|
if fn in ("requirements.txt",) or fn.startswith("requirements"):
|
|
53
59
|
return _from_requirements(content)
|
|
54
60
|
if fn.endswith(".py"):
|
|
55
|
-
return _from_python(content)
|
|
61
|
+
return _from_python(content, local_modules)
|
|
56
62
|
return []
|
|
57
63
|
|
|
58
64
|
|
|
59
|
-
def _from_python(content: str) -> list[dict]:
|
|
65
|
+
def _from_python(content: str, local: set[str] | None = None) -> list[dict]:
|
|
66
|
+
local = local or set()
|
|
60
67
|
out, seen = [], set()
|
|
61
68
|
for imp, frm in _IMPORT_RE.findall(content):
|
|
62
69
|
mod = (imp or frm).split(".")[0]
|
|
63
|
-
if not mod or mod.startswith("_") or mod in _STDLIB or mod in seen:
|
|
70
|
+
if not mod or mod.startswith("_") or mod in _STDLIB or mod in seen or mod in local:
|
|
64
71
|
continue
|
|
65
72
|
seen.add(mod)
|
|
66
73
|
dist = _PYPI_ALIASES.get(mod, mod)
|
|
@@ -117,11 +124,15 @@ def check_exists(name: str, ecosystem: str) -> bool | None:
|
|
|
117
124
|
return None
|
|
118
125
|
|
|
119
126
|
|
|
120
|
-
def audit(content: str, filename: str) -> dict:
|
|
121
|
-
"""Audit a change's dependencies. Returns findings + the hallucinated list.
|
|
127
|
+
def audit(content: str, filename: str, local_modules: set[str] | None = None) -> dict:
|
|
128
|
+
"""Audit a change's dependencies. Returns findings + the hallucinated list.
|
|
129
|
+
|
|
130
|
+
`local_modules` are workspace-local module names (sibling files, local
|
|
131
|
+
packages) that must not be checked against PyPI/npm.
|
|
132
|
+
"""
|
|
122
133
|
findings = []
|
|
123
134
|
hallucinated = []
|
|
124
|
-
for dep in extract_dependencies(content, filename):
|
|
135
|
+
for dep in extract_dependencies(content, filename, local_modules):
|
|
125
136
|
exists = check_exists(dep["name"], dep["ecosystem"])
|
|
126
137
|
status = "ok" if exists is True else "missing" if exists is False else "unknown"
|
|
127
138
|
findings.append({"name": dep["name"], "ecosystem": dep["ecosystem"], "status": status})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
You are DeepParallel, a precise coding assistant from Crowe Logic.
|
|
2
|
+
|
|
3
|
+
Voice: direct and concise. Lead with the answer, not a preamble — never open with "I'd be happy to", "Great question", or by restating the request. Give depth only when asked or when the problem genuinely needs it. Stop when the answer is complete; don't pad with summaries or follow-up offers unless they add real value.
|
|
4
|
+
|
|
5
|
+
Formatting: clean Markdown. Single blank lines between paragraphs — never double. Fenced code blocks with a language tag for code, inline backticks for identifiers and paths, tight lists (no blank line between items). Prefer a short prose answer over a bulleted list when a sentence will do.
|
|
6
|
+
|
|
7
|
+
You can use tools to read, search, analyze, edit, open, and run code. Use them when they help; do not call them speculatively. When the user asks to "open" a file (an HTML report, image, PDF, or folder) for viewing, use open_path to launch it in the default app rather than read_file, which only returns text. When asked to run something with different parameters, prefer non-destructive approaches (CLI arguments, environment variables, or a temporary copy) over editing the user's source files. Only edit a source file when changing it is the actual goal, and explain what you changed.
|
|
8
|
+
|
|
9
|
+
Engineering discipline — how you build:
|
|
10
|
+
- Build the smallest unit that can be verified, and verify it before scaling up. Before generating a multi-file system, write the single most fundamental primitive and run it (or a one-line check) to confirm it works. Never emit hundreds of lines across several files before executing anything — a wrong assumption then costs many rounds of debugging instead of one.
|
|
11
|
+
- Ground before you generate. For domain work (chemistry, biology, finance, an API or library you are not certain of), prefer retrieving real data or references over inventing them. Use mcp_search with a single keyword (e.g. "pubchem") to find a domain MCP server, web_fetch for documentation, and read_file/grep for local truth. Reach for a database or a reference before reconstructing it from memory.
|
|
12
|
+
- Treat warnings as signal, not noise. A Guardian "risky/bug" verdict, a supply-chain flag, a parser or valence error, or a low similarity-to-reference score is evidence that something is wrong. Investigate and fix the cause; never rationalize it away or approve through it.
|
|
13
|
+
- Validate against known-good references. When generating structured artifacts (molecules, schemas, configs, queries), check a sample against a known-correct example before trusting the whole batch. If your output does not resemble the references you expect, the generator is wrong, not the references.
|
|
14
|
+
- Label honestly. Never emit an output whose name, ID, or label does not match what it actually is. If you cannot represent something correctly, say so rather than silently substituting a near-miss.
|
|
@@ -10,6 +10,7 @@ from __future__ import annotations
|
|
|
10
10
|
|
|
11
11
|
import json
|
|
12
12
|
import os
|
|
13
|
+
import re
|
|
13
14
|
import subprocess
|
|
14
15
|
import sys
|
|
15
16
|
import threading
|
|
@@ -159,6 +160,35 @@ def _reap_idle() -> None:
|
|
|
159
160
|
del _pool[key]
|
|
160
161
|
|
|
161
162
|
|
|
163
|
+
def _registry_query(query: str, limit: int) -> list[dict]:
|
|
164
|
+
"""One registry search call; returns raw server entries (possibly empty)."""
|
|
165
|
+
r = httpx.get(
|
|
166
|
+
_REGISTRY_API,
|
|
167
|
+
params={"search": query, "limit": limit},
|
|
168
|
+
timeout=_TIMEOUT,
|
|
169
|
+
headers={"user-agent": _UA},
|
|
170
|
+
)
|
|
171
|
+
r.raise_for_status()
|
|
172
|
+
return r.json().get("servers", [])
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def _format_server(entry: dict) -> dict:
|
|
176
|
+
server = entry.get("server", entry)
|
|
177
|
+
return {
|
|
178
|
+
"name": server.get("name", "unknown"),
|
|
179
|
+
"description": server.get("description", ""),
|
|
180
|
+
"version": server.get("version", ""),
|
|
181
|
+
"packages": [
|
|
182
|
+
{
|
|
183
|
+
"type": p.get("registryType", ""),
|
|
184
|
+
"package": p.get("identifier", ""),
|
|
185
|
+
"transport": p.get("transport", {}).get("type", "unknown"),
|
|
186
|
+
}
|
|
187
|
+
for p in server.get("packages", [])
|
|
188
|
+
],
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
|
|
162
192
|
@tool(dangerous=False)
|
|
163
193
|
def mcp_search(query: str, limit: int = 10) -> str:
|
|
164
194
|
"""Search the MCP server registry (5,800+ servers) for a capability.
|
|
@@ -166,39 +196,34 @@ def mcp_search(query: str, limit: int = 10) -> str:
|
|
|
166
196
|
Returns matching server names, descriptions, and package install info.
|
|
167
197
|
Use this first to discover what exists, then mcp_list_tools to connect.
|
|
168
198
|
|
|
169
|
-
:param query:
|
|
199
|
+
:param query: A single capability keyword works best (e.g. "pubchem",
|
|
200
|
+
"postgres", "slack"); multi-word phrases are split and merged automatically.
|
|
170
201
|
:param limit: Maximum number of results (max 50).
|
|
171
202
|
"""
|
|
172
203
|
limit = min(int(limit), 50)
|
|
173
204
|
try:
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
205
|
+
servers = _registry_query(query, limit)
|
|
206
|
+
# The registry matches substrings, not phrases or meaning: a natural-
|
|
207
|
+
# language query like "chemistry molecular docking" matches nothing,
|
|
208
|
+
# while the single word "chemistry" finds servers. When a multi-word
|
|
209
|
+
# query comes back empty, retry each significant word and merge, so the
|
|
210
|
+
# model discovers servers without having to guess the exact term.
|
|
211
|
+
if not servers:
|
|
212
|
+
words = [w for w in re.findall(r"[A-Za-z0-9]+", query.lower()) if len(w) > 2]
|
|
213
|
+
seen: set[str] = set()
|
|
214
|
+
merged: list[dict] = []
|
|
215
|
+
for word in dict.fromkeys(words):
|
|
216
|
+
for entry in _registry_query(word, limit):
|
|
217
|
+
name = entry.get("server", entry).get("name", "")
|
|
218
|
+
if name and name not in seen:
|
|
219
|
+
seen.add(name)
|
|
220
|
+
merged.append(entry)
|
|
221
|
+
if len(merged) >= limit:
|
|
222
|
+
break
|
|
223
|
+
servers = merged[:limit]
|
|
182
224
|
except Exception as e: # noqa: BLE001 - surface registry failure to the model
|
|
183
225
|
return json.dumps({"error": f"registry search failed: {type(e).__name__}: {e}"})
|
|
184
|
-
results = []
|
|
185
|
-
for entry in data.get("servers", []):
|
|
186
|
-
server = entry.get("server", entry)
|
|
187
|
-
results.append(
|
|
188
|
-
{
|
|
189
|
-
"name": server.get("name", "unknown"),
|
|
190
|
-
"description": server.get("description", ""),
|
|
191
|
-
"version": server.get("version", ""),
|
|
192
|
-
"packages": [
|
|
193
|
-
{
|
|
194
|
-
"type": p.get("registryType", ""),
|
|
195
|
-
"package": p.get("identifier", ""),
|
|
196
|
-
"transport": p.get("transport", {}).get("type", "unknown"),
|
|
197
|
-
}
|
|
198
|
-
for p in server.get("packages", [])
|
|
199
|
-
],
|
|
200
|
-
}
|
|
201
|
-
)
|
|
226
|
+
results = [_format_server(entry) for entry in servers]
|
|
202
227
|
return json.dumps({"query": query, "count": len(results), "servers": results})
|
|
203
228
|
|
|
204
229
|
|
|
@@ -46,10 +46,10 @@ def web_search(query: str, count: int = 5) -> str:
|
|
|
46
46
|
:param query: The search query.
|
|
47
47
|
:param count: Maximum number of results.
|
|
48
48
|
"""
|
|
49
|
-
key = os.environ.get("DEEPPARALLEL_SEARCH_API_KEY")
|
|
49
|
+
key = (os.environ.get("DEEPPARALLEL_SEARCH_API_KEY") or "").strip()
|
|
50
50
|
if not key:
|
|
51
51
|
return json.dumps(
|
|
52
|
-
{"error": "search not configured: set DEEPPARALLEL_SEARCH_API_KEY (Brave Search API)"}
|
|
52
|
+
{"error": "search not configured: set DEEPPARALLEL_SEARCH_API_KEY (Brave Search API key)"}
|
|
53
53
|
)
|
|
54
54
|
url = os.environ.get(
|
|
55
55
|
"DEEPPARALLEL_SEARCH_URL", "https://api.search.brave.com/res/v1/web/search"
|
|
@@ -61,7 +61,13 @@ def web_search(query: str, count: int = 5) -> str:
|
|
|
61
61
|
headers={"X-Subscription-Token": key, "accept": "application/json"},
|
|
62
62
|
timeout=_TIMEOUT,
|
|
63
63
|
)
|
|
64
|
-
r.
|
|
64
|
+
if r.status_code >= 400:
|
|
65
|
+
# Surface the provider's error body: a bare "422" hides the reason
|
|
66
|
+
# (missing key header, over-long query, plan limit). The body tells
|
|
67
|
+
# the model and the user exactly what to fix.
|
|
68
|
+
return json.dumps(
|
|
69
|
+
{"error": f"search failed: HTTP {r.status_code}: {(r.text or '')[:300]}"}
|
|
70
|
+
)
|
|
65
71
|
data = r.json()
|
|
66
72
|
except Exception as e: # noqa: BLE001 - surface search failure to the model
|
|
67
73
|
return json.dumps({"error": f"search failed: {type(e).__name__}: {e}"})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: deepparallel
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: DeepParallel - a multi-model agentic coding CLI with cross-model Guardian review, served via Crowe Logic.
|
|
5
5
|
Author-email: Michael Crowe <michael@crowelogic.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "deepparallel"
|
|
7
|
-
version = "0.5.
|
|
7
|
+
version = "0.5.2"
|
|
8
8
|
description = "DeepParallel - a multi-model agentic coding CLI with cross-model Guardian review, served via Crowe Logic."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "Apache-2.0" }
|
|
@@ -69,3 +69,21 @@ def test_check_pypi_existence(monkeypatch):
|
|
|
69
69
|
def test_audit_empty_when_no_deps():
|
|
70
70
|
out = sc.audit("x = 1\nprint(x)\n", "app.py")
|
|
71
71
|
assert out["findings"] == [] and out["hallucinated"] == []
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def test_audit_skips_workspace_local_modules(monkeypatch):
|
|
75
|
+
# 200 for requests, 404 for everything else (so a local module would be
|
|
76
|
+
# falsely flagged if it were checked).
|
|
77
|
+
def fake_get(url, **kw):
|
|
78
|
+
code = 200 if "/requests/" in url else 404
|
|
79
|
+
return httpx.Response(code, request=httpx.Request("GET", url))
|
|
80
|
+
|
|
81
|
+
monkeypatch.setattr(httpx, "get", fake_get)
|
|
82
|
+
code = "from compound_library import build\nimport receptor_analysis\nimport requests\n"
|
|
83
|
+
out = sc.audit(code, "scripts/workflow.py",
|
|
84
|
+
local_modules={"compound_library", "receptor_analysis"})
|
|
85
|
+
names = {f["name"] for f in out["findings"]}
|
|
86
|
+
assert "compound_library" not in names # local, never checked
|
|
87
|
+
assert "receptor_analysis" not in names
|
|
88
|
+
assert "requests" in names
|
|
89
|
+
assert out["hallucinated"] == [] # the false positive is gone
|
|
@@ -45,3 +45,38 @@ def test_call_tool_rejects_bad_arguments_json():
|
|
|
45
45
|
def test_stop_server_not_running():
|
|
46
46
|
out = json.loads(mcp_mod.mcp_stop_server("never-started"))
|
|
47
47
|
assert out["note"] == "never-started was not running"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def test_mcp_search_multiword_falls_back_to_keywords(monkeypatch):
|
|
51
|
+
# The registry matches substrings: a phrase returns nothing, but a single
|
|
52
|
+
# keyword finds a server. mcp_search should split and merge automatically.
|
|
53
|
+
calls = []
|
|
54
|
+
|
|
55
|
+
def fake_query(query, limit):
|
|
56
|
+
calls.append(query)
|
|
57
|
+
if " " in query:
|
|
58
|
+
return [] # phrase matches nothing, like the real registry
|
|
59
|
+
if query == "pubchem":
|
|
60
|
+
return [{"server": {"name": "io.github.cyanheads/pubchem-mcp-server",
|
|
61
|
+
"description": "Search compounds.", "packages": []}}]
|
|
62
|
+
return []
|
|
63
|
+
|
|
64
|
+
monkeypatch.setattr(mcp_mod, "_registry_query", fake_query)
|
|
65
|
+
out = json.loads(mcp_mod.mcp_search("pubchem chembl bioassay"))
|
|
66
|
+
assert out["count"] >= 1
|
|
67
|
+
assert any("pubchem" in s["name"] for s in out["servers"])
|
|
68
|
+
assert "pubchem chembl bioassay" in calls # tried the phrase first
|
|
69
|
+
assert "pubchem" in calls # then fell back to the keyword
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def test_mcp_search_single_word_skips_fallback(monkeypatch):
|
|
73
|
+
calls = []
|
|
74
|
+
|
|
75
|
+
def fake_query(query, limit):
|
|
76
|
+
calls.append(query)
|
|
77
|
+
return [{"server": {"name": "ai.waystation/postgres", "packages": []}}]
|
|
78
|
+
|
|
79
|
+
monkeypatch.setattr(mcp_mod, "_registry_query", fake_query)
|
|
80
|
+
out = json.loads(mcp_mod.mcp_search("postgres"))
|
|
81
|
+
assert out["count"] == 1
|
|
82
|
+
assert calls == ["postgres"] # primary hit, no fallback fan-out
|
|
@@ -80,3 +80,18 @@ def test_web_search_parses_results(monkeypatch):
|
|
|
80
80
|
|
|
81
81
|
def test_web_search_is_non_dangerous():
|
|
82
82
|
assert get_registry().get("web_search").dangerous is False
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def test_web_search_surfaces_http_error_body(monkeypatch):
|
|
86
|
+
monkeypatch.setenv("DEEPPARALLEL_SEARCH_API_KEY", "k")
|
|
87
|
+
body = '{"error":{"detail":"x-subscription-token Field required"}}'
|
|
88
|
+
monkeypatch.setattr(httpx, "get", lambda url, **kw: _Resp(text=body, status=422))
|
|
89
|
+
out = json.loads(web_mod.web_search("anything"))
|
|
90
|
+
assert "HTTP 422" in out["error"]
|
|
91
|
+
assert "x-subscription-token" in out["error"] # the real reason, not a bare 422
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def test_web_search_blank_key_treated_as_unconfigured(monkeypatch):
|
|
95
|
+
monkeypatch.setenv("DEEPPARALLEL_SEARCH_API_KEY", " ")
|
|
96
|
+
out = json.loads(web_mod.web_search("anything"))
|
|
97
|
+
assert "DEEPPARALLEL_SEARCH_API_KEY" in out["error"]
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
You are DeepParallel, a precise coding assistant from Crowe Logic.
|
|
2
|
-
|
|
3
|
-
Voice: direct and concise. Lead with the answer, not a preamble — never open with "I'd be happy to", "Great question", or by restating the request. Give depth only when asked or when the problem genuinely needs it. Stop when the answer is complete; don't pad with summaries or follow-up offers unless they add real value.
|
|
4
|
-
|
|
5
|
-
Formatting: clean Markdown. Single blank lines between paragraphs — never double. Fenced code blocks with a language tag for code, inline backticks for identifiers and paths, tight lists (no blank line between items). Prefer a short prose answer over a bulleted list when a sentence will do.
|
|
6
|
-
|
|
7
|
-
You can use tools to read, search, analyze, edit, open, and run code. Use them when they help; do not call them speculatively. When the user asks to "open" a file (an HTML report, image, PDF, or folder) for viewing, use open_path to launch it in the default app rather than read_file, which only returns text. When asked to run something with different parameters, prefer non-destructive approaches (CLI arguments, environment variables, or a temporary copy) over editing the user's source files. Only edit a source file when changing it is the actual goal, and explain what you changed.
|
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|