426e9eeabd
Voice Workbench / headless workbench (mocked backends) (push) Has been cancelled
Voice Workbench / real acoustic lane (nightly, provisioned only) (push) Has been cancelled
ci / test (push) Has been cancelled
ci / lint-and-format (push) Has been cancelled
ci / build (push) Has been cancelled
ci / dev-startup (push) Has been cancelled
gitleaks / gitleaks (push) Has been cancelled
Markdown Links / Relative Markdown Links (push) Has been cancelled
Quality (Extended) / Homepage Build (PR smoke) (push) Has been cancelled
Quality (Extended) / Comment-only diff guard (push) Has been cancelled
Quality (Extended) / Format + Type Safety Ratchet (push) Has been cancelled
Quality (Extended) / Develop Gate (secret scan + UI determinism) (push) Has been cancelled
Quality (Extended) / Develop Gate (lint) (push) Has been cancelled
Chat shell gestures / Chat shell gesture + parity e2e (push) Has been cancelled
Cloud Gateway Discord / Test (push) Has been cancelled
Benchmark Bridge Tests / benchmark (bunx @biomejs/biome check packages/lifeops-bench/src, benchmark-lint) (push) Has been cancelled
Benchmark Bridge Tests / benchmark (bunx vitest run --config packages/lifeops-bench/vitest.config.ts --root packages/lifeops-bench --passWithNoTests, benchmark-tests) (push) Has been cancelled
Build Agent Image / build-and-push (push) Has been cancelled
Dev Smoke / bun run dev onboarding chat (push) Has been cancelled
Dev Smoke / Vite HMR dependency-level smoke (push) Has been cancelled
Electrobun Submodule Guard / electrobun gitlink is fetchable (push) Has been cancelled
Publish @elizaos/example-code / check_npm (push) Has been cancelled
Publish @elizaos/example-code / publish_npm (push) Has been cancelled
Publish @elizaos/plugin-elizacloud / verify_version (push) Has been cancelled
Publish @elizaos/plugin-elizacloud / publish_npm (push) Has been cancelled
Sandbox Live Smoke / Sandbox live smoke (push) Has been cancelled
Snap Build & Test / Build Snap (amd64) (push) Has been cancelled
Snap Build & Test / Build Snap (arm64) (push) Has been cancelled
Test Packaging / elizaos CLI global-install smoke (node + bun) (push) Has been cancelled
Cloud Gateway Webhook / Test (push) Has been cancelled
Cloud Tests / lint-and-types (push) Has been cancelled
Cloud Tests / unit-tests (push) Has been cancelled
Cloud Tests / integration-tests (push) Has been cancelled
Cloud Tests / e2e-tests (push) Has been cancelled
CodeQL Advanced / Analyze (javascript-typescript) (push) Has been cancelled
Deploy Apps Worker (Product 2) / Determine environment (push) Has been cancelled
Deploy Apps Worker (Product 2) / Deploy apps worker to apps-control host (${{ needs.determine-env.outputs.environment }}) (push) Has been cancelled
Deploy Eliza Provisioning Worker / Determine environment (push) Has been cancelled
Deploy Eliza Provisioning Worker / Deploy worker to Hetzner host (${{ needs.determine-env.outputs.environment }} @ ${{ needs.determine-env.outputs.deployment_sha }}) (push) Has been cancelled
Dev Smoke / Classify changed paths (push) Has been cancelled
supply-chain / sbom (push) Has been cancelled
supply-chain / vulnerability-scan (push) Has been cancelled
Build, Push & Deploy to Phala Cloud / build-and-push (push) Has been cancelled
Test Packaging / Validate Packaging Configs (push) Has been cancelled
Test Packaging / Build & Test PyPI Package (push) Has been cancelled
Test Packaging / PyPI on Python ${{ matrix.python }} (push) Has been cancelled
Test Packaging / Pack & Test JS Tarballs (push) Has been cancelled
UI Fixture E2E / ui-fixture-e2e (push) Has been cancelled
UI Fixture E2E / fixture-e2e (push) Has been cancelled
UI Story Gate / story-gate (push) Has been cancelled
vault-ci / test (macos-latest) (push) Has been cancelled
vault-ci / test (ubuntu-latest) (push) Has been cancelled
vault-ci / test (windows-latest) (push) Has been cancelled
vault-ci / app-core wiring tests (push) Has been cancelled
verify-patches / verify patches/CHECKSUMS.sha256 (push) Has been cancelled
Voice Benchmark Smoke / voice-emotion fixture smoke (push) Has been cancelled
Voice Benchmark Smoke / voiceagentbench fixture smoke (push) Has been cancelled
Voice Benchmark Smoke / voicebench-quality unit smoke (push) Has been cancelled
Voice Benchmark Smoke / voicebench TypeScript unit (no audio) (push) Has been cancelled
Voice Benchmark Smoke / voice bench smoke summary (push) Has been cancelled
Windows CI / windows ([bun run --cwd packages/app-core test bun run --cwd packages/elizaos test bun run --cwd packages/cloud/shared test], app-and-cli) (push) Has been cancelled
Windows CI / windows ([bun run --cwd packages/scenario-runner test bun run --cwd packages/vault test bun run --cwd packages/security test bun run --cwd plugins/plugin-coding-tools test], framework-packages) (push) Has been cancelled
Windows CI / windows ([bun run --cwd plugins/plugin-elizacloud test bun run --cwd plugins/plugin-discord test bun run --cwd plugins/plugin-anthropic test bun run --cwd plugins/plugin-openai test bun run --cwd plugins/plugin-app-control test bun run --cwd plugins/pl… (push) Has been cancelled
Windows CI / windows ([node packages/scripts/run-turbo.mjs run build --filter=@elizaos/core --filter=@elizaos/shared --filter=@elizaos/agent --concurrency=4 node packages/scripts/run-bash-linux-only.mjs scripts/verify-riscv64-buildpaths.sh node packages/scripts/run… (push) Has been cancelled
Windows CI / windows ([node packages/scripts/run-turbo.mjs run typecheck --filter=@elizaos/core --filter=@elizaos/shared --filter=@elizaos/cloud-shared --concurrency=4 bun run --cwd packages/core test bun run --cwd packages/shared test], core-runtime, 75) (push) Has been cancelled
123 lines
4.4 KiB
Python
123 lines
4.4 KiB
Python
"""Resolver for `source: { type: local_path, ... }` entries in datasets.yaml.
|
|
|
|
This is the Python-side reader for the nightly JSONL export that the TS
|
|
trajectory-export cron writes under ``~/.eliza/training/datasets/<YYYY-MM-DD>/``.
|
|
The TS side already runs the privacy filter — Python does NOT re-filter rows
|
|
read from this path.
|
|
|
|
Schema:
|
|
|
|
- slug: <required>
|
|
source:
|
|
type: local_path
|
|
root: <path with optional ${VAR:-default} expansion>
|
|
glob: <glob relative to root, e.g. "*/action_planner_trajectories.jsonl">
|
|
task: <eliza_native task_type, e.g. action_planner> # optional
|
|
normalizer: eliza_native_passthrough
|
|
weight: <float>
|
|
|
|
Resolution rules:
|
|
|
|
- ``root`` may contain a single ``${VAR}`` or ``${VAR:-default}`` token.
|
|
The token is replaced with the environment value (or the default), then
|
|
``~`` and any embedded ``..`` are resolved against the file system.
|
|
- The glob is evaluated under the resolved root with ``Path.glob``. A
|
|
missing root directory is NOT an error — the resolver returns an empty
|
|
list. Callers (download_datasets.py, the normalize adapter) treat an
|
|
empty match as "skip this entry, log a warning".
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import logging
|
|
import os
|
|
import re
|
|
from dataclasses import dataclass
|
|
from pathlib import Path
|
|
from typing import Any
|
|
|
|
log = logging.getLogger("local_path_source")
|
|
|
|
# ${VAR} or ${VAR:-default}. We deliberately accept exactly one token; the
|
|
# nightly-export schema only ever needs ELIZA_STATE_DIR or ELIZA_STATE_DIR.
|
|
_ENV_VAR_RE = re.compile(r"\$\{(?P<name>[A-Z_][A-Z0-9_]*)(?::-(?P<default>[^}]*))?\}")
|
|
|
|
|
|
def expand_env(value: str) -> str:
|
|
"""Expand a single ``${VAR}`` / ``${VAR:-default}`` token plus ``~``.
|
|
|
|
Unset variables with no default expand to the empty string; the caller
|
|
will then see a non-existent path and skip.
|
|
"""
|
|
|
|
def _sub(match: re.Match[str]) -> str:
|
|
name = match.group("name")
|
|
default = match.group("default") or ""
|
|
return os.environ.get(name, default)
|
|
|
|
expanded = _ENV_VAR_RE.sub(_sub, value)
|
|
return os.path.expanduser(expanded)
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class LocalPathSource:
|
|
"""Parsed view of an ``entry.source`` block whose ``type == local_path``."""
|
|
|
|
root: Path
|
|
glob: str
|
|
task: str | None
|
|
|
|
@classmethod
|
|
def from_entry(cls, entry: dict[str, Any]) -> "LocalPathSource | None":
|
|
"""Return the parsed source for an entry, or None if it's not local_path.
|
|
|
|
Raises ``ValueError`` if ``source.type == 'local_path'`` but required
|
|
fields are missing — we fail loud rather than silently passing a
|
|
malformed entry through.
|
|
"""
|
|
source = entry.get("source")
|
|
if not isinstance(source, dict):
|
|
return None
|
|
if source.get("type") != "local_path":
|
|
return None
|
|
root_raw = source.get("root")
|
|
if not isinstance(root_raw, str) or not root_raw.strip():
|
|
raise ValueError(
|
|
f"entry {entry.get('slug') or entry.get('id')!r} has "
|
|
f"source.type=local_path but no source.root string"
|
|
)
|
|
glob = source.get("glob")
|
|
if not isinstance(glob, str) or not glob.strip():
|
|
raise ValueError(
|
|
f"entry {entry.get('slug') or entry.get('id')!r} has "
|
|
f"source.type=local_path but no source.glob string"
|
|
)
|
|
task = source.get("task")
|
|
if task is not None and not isinstance(task, str):
|
|
raise ValueError(
|
|
f"entry {entry.get('slug') or entry.get('id')!r} has a "
|
|
f"non-string source.task: {task!r}"
|
|
)
|
|
return cls(root=Path(expand_env(root_raw)), glob=glob, task=task)
|
|
|
|
def resolve_files(self) -> list[Path]:
|
|
"""Return the resolved list of files matched by the glob, sorted.
|
|
|
|
Empty result when the root does not exist or no files match — this
|
|
is the documented "skip with warning" path, not an error.
|
|
"""
|
|
if not self.root.exists() or not self.root.is_dir():
|
|
log.warning(
|
|
"local_path root %s does not exist; skipping", self.root
|
|
)
|
|
return []
|
|
matches = sorted(self.root.glob(self.glob))
|
|
files = [p for p in matches if p.is_file()]
|
|
if not files:
|
|
log.warning(
|
|
"local_path glob %s/%s matched no files; skipping",
|
|
self.root,
|
|
self.glob,
|
|
)
|
|
return files
|