parallel-web-tools 0.4.0rc2__tar.gz → 0.5.0__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.
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/PKG-INFO +1 -1
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/__init__.py +1 -1
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/cli/commands.py +36 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/cli/skills.py +6 -10
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/skills.py +94 -100
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/bigquery/cloud_function/requirements.txt +1 -1
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/pyproject.toml +1 -1
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/.gitignore +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/README.md +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/cli/__init__.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/cli/planner.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/cli/updater.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/__init__.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/auth.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/batch.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/credentials.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/endpoints.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/findall.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/monitor.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/polling.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/research.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/result.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/runner.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/schema.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/service.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/service_types.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/sql_utils.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/user_agent.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/__init__.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/bigquery/__init__.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/bigquery/cloud_function/main.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/bigquery/deploy.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/bigquery/sql/create_functions.sql +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/duckdb/__init__.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/duckdb/batch.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/duckdb/findall.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/duckdb/udf.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/polars/__init__.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/polars/enrich.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/snowflake/__init__.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/snowflake/deploy.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/snowflake/sql/01_setup.sql +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/snowflake/sql/02_create_udf.sql +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/snowflake/sql/03_cleanup.sql +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/spark/__init__.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/spark/streaming.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/spark/udf.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/utils.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/processors/__init__.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/processors/bigquery.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/processors/csv.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/processors/duckdb.py +0 -0
- {parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/processors/json.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: parallel-web-tools
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: Parallel Tools: CLI and Python SDK for AI-powered web intelligence
|
|
5
5
|
Project-URL: Homepage, https://github.com/parallel-web/parallel-web-tools
|
|
6
6
|
Project-URL: Documentation, https://docs.parallel.ai
|
|
@@ -174,6 +174,35 @@ def _extract_api_message(error: Exception) -> str:
|
|
|
174
174
|
return str(error)
|
|
175
175
|
|
|
176
176
|
|
|
177
|
+
def _legacy_credentials_in_use() -> bool:
|
|
178
|
+
"""True when the active API key comes from the v0→v1 migrated ``legacy`` org.
|
|
179
|
+
|
|
180
|
+
Env-var keys win over stored creds in :func:`resolve_api_key`, so we only
|
|
181
|
+
flag legacy state when no ``PARALLEL_API_KEY`` is set — otherwise the user's
|
|
182
|
+
error has nothing to do with their on-disk credentials.
|
|
183
|
+
"""
|
|
184
|
+
if os.environ.get("PARALLEL_API_KEY"):
|
|
185
|
+
return False
|
|
186
|
+
from parallel_web_tools.core import credentials
|
|
187
|
+
|
|
188
|
+
creds = credentials.load()
|
|
189
|
+
if creds is None:
|
|
190
|
+
return False
|
|
191
|
+
return creds.selected_org_id == credentials.LEGACY_ORG_ID
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def _is_legacy_account_api_failure(error: Exception) -> bool:
|
|
195
|
+
"""Detect a legacy user attempting an Account API operation.
|
|
196
|
+
|
|
197
|
+
``ReauthenticationRequired`` fires from :func:`get_control_api_access_token`
|
|
198
|
+
whenever there are no usable control-API tokens. For a v0→v1 migrated user
|
|
199
|
+
this is expected: their stored ``api_key`` works for the standard Parallel
|
|
200
|
+
API, but they never went through the device flow that mints control tokens,
|
|
201
|
+
so any Account API call fails here.
|
|
202
|
+
"""
|
|
203
|
+
return isinstance(error, ReauthenticationRequired) and _legacy_credentials_in_use()
|
|
204
|
+
|
|
205
|
+
|
|
177
206
|
def _handle_error(
|
|
178
207
|
error: Exception,
|
|
179
208
|
output_json: bool = False,
|
|
@@ -186,6 +215,13 @@ def _handle_error(
|
|
|
186
215
|
Rich-formatted error message.
|
|
187
216
|
"""
|
|
188
217
|
message = _extract_api_message(error)
|
|
218
|
+
if _is_legacy_account_api_failure(error):
|
|
219
|
+
message = (
|
|
220
|
+
"This operation requires Account API credentials, but your stored "
|
|
221
|
+
"credentials only authorize the standard Parallel API. Re-run "
|
|
222
|
+
"'parallel-cli login' to authenticate against the Account API."
|
|
223
|
+
)
|
|
224
|
+
exit_code = EXIT_AUTH_ERROR
|
|
189
225
|
if output_json:
|
|
190
226
|
error_data = {"error": {"message": message, "type": type(error).__name__}}
|
|
191
227
|
print(json.dumps(error_data, indent=2))
|
|
@@ -35,19 +35,19 @@ def create_skills_group(
|
|
|
35
35
|
def skills() -> None:
|
|
36
36
|
"""Install and manage Parallel agent skills.
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Downloads come from skills.parallel.ai. Set PARALLEL_SKILLS_INDEX_URL to use a custom index.
|
|
39
39
|
"""
|
|
40
40
|
pass
|
|
41
41
|
|
|
42
42
|
@skills.command(name="list")
|
|
43
43
|
@click.option("--json", "output_json", is_flag=True, help="Output as JSON")
|
|
44
44
|
def skills_list(output_json: bool) -> None:
|
|
45
|
-
"""List available Parallel skills from
|
|
46
|
-
from parallel_web_tools.core.skills import SkillsError,
|
|
45
|
+
"""List available Parallel skills from skills.parallel.ai."""
|
|
46
|
+
from parallel_web_tools.core.skills import SkillsError, get_remote_skills_channel, list_remote_skills
|
|
47
47
|
|
|
48
48
|
try:
|
|
49
|
-
ref =
|
|
50
|
-
skill_names = list_remote_skills(
|
|
49
|
+
ref = get_remote_skills_channel()
|
|
50
|
+
skill_names = list_remote_skills()
|
|
51
51
|
except SkillsError as e:
|
|
52
52
|
handle_error(e, output_json=output_json, exit_code=exit_api_error, prefix="Skills list failed")
|
|
53
53
|
except Exception as e:
|
|
@@ -76,7 +76,7 @@ def create_skills_group(
|
|
|
76
76
|
)
|
|
77
77
|
@click.option("--json", "output_json", is_flag=True, help="Output as JSON")
|
|
78
78
|
def skills_install(project: bool, skill_names: tuple[str, ...], output_json: bool) -> None:
|
|
79
|
-
"""Install Parallel skills from
|
|
79
|
+
"""Install Parallel skills from skills.parallel.ai.
|
|
80
80
|
|
|
81
81
|
When --skill is provided, the managed install set is replaced with exactly
|
|
82
82
|
the listed skills.
|
|
@@ -85,7 +85,6 @@ def create_skills_group(
|
|
|
85
85
|
SkillsError,
|
|
86
86
|
SkillsInputError,
|
|
87
87
|
SkillsInstallLocationError,
|
|
88
|
-
get_skills_repo_ref,
|
|
89
88
|
install_skills,
|
|
90
89
|
resolve_install_dir,
|
|
91
90
|
)
|
|
@@ -95,7 +94,6 @@ def create_skills_group(
|
|
|
95
94
|
result = install_skills(
|
|
96
95
|
install_dir=install_dir,
|
|
97
96
|
selected_skills=list(skill_names) or None,
|
|
98
|
-
ref=get_skills_repo_ref(),
|
|
99
97
|
)
|
|
100
98
|
except SkillsInstallLocationError as e:
|
|
101
99
|
handle_error(e, output_json=output_json, exit_code=exit_bad_input, prefix="Skills install failed")
|
|
@@ -170,7 +168,6 @@ def create_skills_group(
|
|
|
170
168
|
SkillsError,
|
|
171
169
|
SkillsInputError,
|
|
172
170
|
SkillsInstallLocationError,
|
|
173
|
-
get_skills_repo_ref,
|
|
174
171
|
reinstall_skills,
|
|
175
172
|
resolve_install_dir,
|
|
176
173
|
)
|
|
@@ -180,7 +177,6 @@ def create_skills_group(
|
|
|
180
177
|
result = reinstall_skills(
|
|
181
178
|
install_dir=install_dir,
|
|
182
179
|
selected_skills=list(skill_names) or None,
|
|
183
|
-
ref=get_skills_repo_ref(),
|
|
184
180
|
)
|
|
185
181
|
except SkillsInstallLocationError as e:
|
|
186
182
|
handle_error(e, output_json=output_json, exit_code=exit_bad_input, prefix="Skills reinstall failed")
|
|
@@ -2,26 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
-
import io
|
|
6
5
|
import json
|
|
7
6
|
import os
|
|
8
7
|
import shutil
|
|
9
|
-
import tempfile
|
|
10
8
|
import time
|
|
11
|
-
import zipfile
|
|
12
9
|
from collections.abc import Iterator
|
|
13
10
|
from contextlib import contextmanager
|
|
14
11
|
from pathlib import Path
|
|
15
|
-
from
|
|
12
|
+
from typing import Any
|
|
16
13
|
|
|
17
14
|
import httpx
|
|
18
15
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
SKILLS_REPO_SKILLS_PATH = "skills"
|
|
16
|
+
DEFAULT_SKILLS_INDEX_URL = "https://skills.parallel.ai/index.json"
|
|
17
|
+
SKILLS_INDEX_URL_ENV = "PARALLEL_SKILLS_INDEX_URL"
|
|
22
18
|
DEFAULT_SKILLS_REPO_REF = "main"
|
|
23
19
|
SKILLS_REPO_REF_ENV = "PARALLEL_SKILLS_REPO_REF"
|
|
24
|
-
GITHUB_TOKEN_ENV = "GH_TOKEN"
|
|
25
20
|
GLOBAL_SKILLS_DIR_ENV = "PARALLEL_SKILLS_GLOBAL_DIR"
|
|
26
21
|
|
|
27
22
|
PROJECT_ROOT_MARKERS = (".git", "pyproject.toml", "package.json")
|
|
@@ -45,13 +40,25 @@ class SkillsInputError(SkillsError):
|
|
|
45
40
|
|
|
46
41
|
|
|
47
42
|
def get_skills_repo_ref() -> str:
|
|
48
|
-
"""Return
|
|
43
|
+
"""Return the legacy requested skills channel/ref override.
|
|
44
|
+
|
|
45
|
+
CDN-backed installs ignore this value and always use the channel advertised by
|
|
46
|
+
the remote index, but we keep the helper for backwards compatibility.
|
|
47
|
+
"""
|
|
49
48
|
configured = os.environ.get(SKILLS_REPO_REF_ENV)
|
|
50
49
|
if configured and configured.strip():
|
|
51
50
|
return configured.strip()
|
|
52
51
|
return DEFAULT_SKILLS_REPO_REF
|
|
53
52
|
|
|
54
53
|
|
|
54
|
+
def get_skills_index_url() -> str:
|
|
55
|
+
"""Return the CDN index URL used for skills downloads."""
|
|
56
|
+
configured = os.environ.get(SKILLS_INDEX_URL_ENV)
|
|
57
|
+
if configured and configured.strip():
|
|
58
|
+
return configured.strip()
|
|
59
|
+
return DEFAULT_SKILLS_INDEX_URL
|
|
60
|
+
|
|
61
|
+
|
|
55
62
|
def get_global_skills_dir() -> Path:
|
|
56
63
|
"""Return the global skills directory path."""
|
|
57
64
|
configured = os.environ.get(GLOBAL_SKILLS_DIR_ENV)
|
|
@@ -84,108 +91,92 @@ def resolve_install_dir(project: bool, start: Path | None = None) -> Path:
|
|
|
84
91
|
return root / ".agents" / "skills"
|
|
85
92
|
|
|
86
93
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
@contextmanager
|
|
95
|
+
def _skills_client() -> Iterator[httpx.Client]:
|
|
96
|
+
with httpx.Client(timeout=30, follow_redirects=True) as client:
|
|
97
|
+
yield client
|
|
90
98
|
|
|
91
99
|
|
|
92
|
-
def
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"
|
|
96
|
-
"X-GitHub-Api-Version": "2022-11-28",
|
|
97
|
-
}
|
|
98
|
-
token = os.environ.get(GITHUB_TOKEN_ENV)
|
|
99
|
-
if token and token.strip():
|
|
100
|
-
headers["Authorization"] = f"Bearer {token.strip()}"
|
|
101
|
-
return headers
|
|
100
|
+
def _fetch_json(client: httpx.Client, url: str, description: str) -> dict[str, Any]:
|
|
101
|
+
response = client.get(url)
|
|
102
|
+
if response.status_code >= 400:
|
|
103
|
+
raise SkillsDownloadError(f"Failed to download {description} from {url}: HTTP {response.status_code}")
|
|
102
104
|
|
|
105
|
+
try:
|
|
106
|
+
data = response.json()
|
|
107
|
+
except ValueError as e:
|
|
108
|
+
raise SkillsDownloadError(f"Failed to parse {description} from {url} as JSON") from e
|
|
103
109
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if response.status_code >= 400:
|
|
108
|
-
raise SkillsDownloadError(
|
|
109
|
-
f"Failed to download skills archive at ref '{ref}' from "
|
|
110
|
-
f"{SKILLS_REPO_OWNER}/{SKILLS_REPO_NAME}: HTTP {response.status_code}"
|
|
111
|
-
)
|
|
112
|
-
return response.content
|
|
110
|
+
if not isinstance(data, dict):
|
|
111
|
+
raise SkillsDownloadError(f"Expected {description} at {url} to be a JSON object")
|
|
112
|
+
return data
|
|
113
113
|
|
|
114
114
|
|
|
115
|
-
def
|
|
116
|
-
|
|
117
|
-
dest_dir.mkdir(parents=True, exist_ok=True)
|
|
115
|
+
def _fetch_skills_index(client: httpx.Client) -> dict[str, Any]:
|
|
116
|
+
return _fetch_json(client, get_skills_index_url(), "skills index")
|
|
118
117
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
parts = member_path.parts
|
|
126
|
-
if not parts:
|
|
127
|
-
continue
|
|
128
|
-
if parts[0] in ("", "/"):
|
|
129
|
-
raise SkillsDownloadError("Invalid archive entry path")
|
|
130
|
-
if any(part == ".." for part in parts):
|
|
131
|
-
raise SkillsDownloadError("Archive contains unsafe path traversal entry")
|
|
132
|
-
if root_name is None:
|
|
133
|
-
root_name = parts[0]
|
|
134
|
-
|
|
135
|
-
target = dest_dir / member_path
|
|
136
|
-
target_resolved = target.resolve()
|
|
137
|
-
dest_resolved = dest_dir.resolve()
|
|
138
|
-
if dest_resolved not in (target_resolved, *target_resolved.parents):
|
|
139
|
-
raise SkillsDownloadError("Archive extraction would escape destination directory")
|
|
140
|
-
|
|
141
|
-
if member.is_dir():
|
|
142
|
-
target.mkdir(parents=True, exist_ok=True)
|
|
143
|
-
continue
|
|
144
|
-
|
|
145
|
-
target.parent.mkdir(parents=True, exist_ok=True)
|
|
146
|
-
with zf.open(member) as src, target.open("wb") as dst:
|
|
147
|
-
shutil.copyfileobj(src, dst)
|
|
148
|
-
except zipfile.BadZipFile as e:
|
|
149
|
-
raise SkillsDownloadError("Failed to read downloaded skills archive") from e
|
|
150
|
-
|
|
151
|
-
if not root_name:
|
|
152
|
-
raise SkillsDownloadError("Downloaded skills archive was empty")
|
|
153
|
-
|
|
154
|
-
root = dest_dir / root_name
|
|
155
|
-
if not root.exists() or not root.is_dir():
|
|
156
|
-
raise SkillsDownloadError("Downloaded skills archive had no repository root directory")
|
|
157
|
-
return root
|
|
118
|
+
|
|
119
|
+
def _index_channel(index: dict[str, Any]) -> str:
|
|
120
|
+
channel = index.get("channel")
|
|
121
|
+
if isinstance(channel, str) and channel.strip():
|
|
122
|
+
return channel.strip()
|
|
123
|
+
return DEFAULT_SKILLS_REPO_REF
|
|
158
124
|
|
|
159
125
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
126
|
+
def _skills_from_index(index: dict[str, Any]) -> dict[str, dict[str, str]]:
|
|
127
|
+
raw_skills = index.get("skills")
|
|
128
|
+
if not isinstance(raw_skills, list):
|
|
129
|
+
raise SkillsDownloadError("Skills index is missing a valid 'skills' list")
|
|
130
|
+
|
|
131
|
+
parsed: dict[str, dict[str, str]] = {}
|
|
132
|
+
for raw_skill in raw_skills:
|
|
133
|
+
if not isinstance(raw_skill, dict):
|
|
134
|
+
raise SkillsDownloadError("Skills index contained an invalid skill entry")
|
|
135
|
+
|
|
136
|
+
name = raw_skill.get("name")
|
|
137
|
+
skill_url = raw_skill.get("skill_url")
|
|
138
|
+
if not isinstance(name, str) or not name.strip():
|
|
139
|
+
raise SkillsDownloadError("Skills index contained a skill with an invalid name")
|
|
140
|
+
if not isinstance(skill_url, str) or not skill_url.strip():
|
|
141
|
+
raise SkillsDownloadError(f"Skills index entry '{name}' is missing a valid skill_url")
|
|
142
|
+
|
|
143
|
+
parsed[name.strip()] = {
|
|
144
|
+
"name": name.strip(),
|
|
145
|
+
"skill_url": skill_url.strip(),
|
|
146
|
+
}
|
|
164
147
|
|
|
165
|
-
|
|
166
|
-
repo_root = _extract_repo_archive(archive_bytes, Path(tmpdir))
|
|
167
|
-
yield repo_root
|
|
148
|
+
return parsed
|
|
168
149
|
|
|
169
150
|
|
|
170
|
-
def
|
|
171
|
-
|
|
172
|
-
|
|
151
|
+
def _list_skills_from_index(index: dict[str, Any]) -> list[str]:
|
|
152
|
+
return sorted(_skills_from_index(index))
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def _download_skill_markdown(client: httpx.Client, skill_name: str, skill_url: str) -> bytes:
|
|
156
|
+
response = client.get(skill_url)
|
|
157
|
+
if response.status_code >= 400:
|
|
173
158
|
raise SkillsDownloadError(
|
|
174
|
-
f"
|
|
159
|
+
f"Failed to download skill '{skill_name}' from {skill_url}: HTTP {response.status_code}"
|
|
175
160
|
)
|
|
176
|
-
return
|
|
161
|
+
return response.content
|
|
177
162
|
|
|
178
163
|
|
|
179
|
-
def
|
|
180
|
-
|
|
181
|
-
|
|
164
|
+
def get_remote_skills_channel() -> str:
|
|
165
|
+
"""Return the channel advertised by the remote CDN index."""
|
|
166
|
+
with _skills_client() as client:
|
|
167
|
+
index = _fetch_skills_index(client)
|
|
168
|
+
return _index_channel(index)
|
|
182
169
|
|
|
183
170
|
|
|
184
171
|
def list_remote_skills(ref: str | None = None) -> list[str]:
|
|
185
|
-
"""Return available skill
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
172
|
+
"""Return available skill names from the CDN index.
|
|
173
|
+
|
|
174
|
+
The ref argument is ignored for CDN-backed installs.
|
|
175
|
+
"""
|
|
176
|
+
del ref
|
|
177
|
+
with _skills_client() as client:
|
|
178
|
+
index = _fetch_skills_index(client)
|
|
179
|
+
return _list_skills_from_index(index)
|
|
189
180
|
|
|
190
181
|
|
|
191
182
|
def _manifest_path(install_dir: Path) -> Path:
|
|
@@ -194,8 +185,7 @@ def _manifest_path(install_dir: Path) -> Path:
|
|
|
194
185
|
|
|
195
186
|
def _write_manifest(install_dir: Path, ref: str, installed_skills: list[str]) -> None:
|
|
196
187
|
data = {
|
|
197
|
-
"
|
|
198
|
-
"skills_path": SKILLS_REPO_SKILLS_PATH,
|
|
188
|
+
"source": get_skills_index_url(),
|
|
199
189
|
"ref": ref,
|
|
200
190
|
"installed_skills": sorted(installed_skills),
|
|
201
191
|
"installed_at": int(time.time()),
|
|
@@ -226,13 +216,15 @@ def install_skills(
|
|
|
226
216
|
Only skills previously managed by parallel-cli are reconciled. Unmanaged skill
|
|
227
217
|
directories are left untouched.
|
|
228
218
|
"""
|
|
229
|
-
|
|
219
|
+
del ref
|
|
230
220
|
|
|
231
|
-
with
|
|
232
|
-
|
|
233
|
-
|
|
221
|
+
with _skills_client() as client:
|
|
222
|
+
index = _fetch_skills_index(client)
|
|
223
|
+
resolved_ref = _index_channel(index)
|
|
224
|
+
available_skills = _skills_from_index(index)
|
|
225
|
+
available = sorted(available_skills)
|
|
234
226
|
requested = sorted(set(selected_skills or available))
|
|
235
|
-
missing = sorted(name for name in requested if name not in
|
|
227
|
+
missing = sorted(name for name in requested if name not in available_skills)
|
|
236
228
|
if missing:
|
|
237
229
|
raise SkillsInputError(
|
|
238
230
|
f"Unknown skills requested: {', '.join(missing)}. Available skills: {', '.join(available)}"
|
|
@@ -256,7 +248,9 @@ def install_skills(
|
|
|
256
248
|
skill_dir = install_dir / skill_name
|
|
257
249
|
if skill_dir.exists():
|
|
258
250
|
shutil.rmtree(skill_dir)
|
|
259
|
-
|
|
251
|
+
skill_dir.mkdir(parents=True, exist_ok=True)
|
|
252
|
+
skill_bytes = _download_skill_markdown(client, skill_name, available_skills[skill_name]["skill_url"])
|
|
253
|
+
(skill_dir / "SKILL.md").write_bytes(skill_bytes)
|
|
260
254
|
|
|
261
255
|
_write_manifest(install_dir, resolved_ref, requested)
|
|
262
256
|
return {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/credentials.py
RENAMED
|
File without changes
|
{parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/endpoints.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/research.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/service_types.py
RENAMED
|
File without changes
|
{parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/sql_utils.py
RENAMED
|
File without changes
|
{parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/core/user_agent.py
RENAMED
|
File without changes
|
{parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/__init__.py
RENAMED
|
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
|
{parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/integrations/utils.py
RENAMED
|
File without changes
|
{parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/processors/__init__.py
RENAMED
|
File without changes
|
{parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/processors/bigquery.py
RENAMED
|
File without changes
|
{parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/processors/csv.py
RENAMED
|
File without changes
|
{parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/processors/duckdb.py
RENAMED
|
File without changes
|
{parallel_web_tools-0.4.0rc2 → parallel_web_tools-0.5.0}/parallel_web_tools/processors/json.py
RENAMED
|
File without changes
|