- root SKILL.md is her upstream file (body byte-identical to the 5fb8379c mirror; description quoted so YAML parses and Mastra can load the skill) - chat binds the whole SKILL.md plus references/product_runtime_contract.md (safety-only) instead of a ~477-character excerpt - every turn carries her full strict-workflow-router (synced to upstream) and the domain's event-judgment file; product lists follow as an extra layer - import her 10 sub-skills, family router, interpretation status contract, technique ontology and the 54 files her method names - tests/test_upstream_skill_parity.py (in the quick gate) fails whenever her skill and ours drift - 18 frontend guards that locked the excerpt design updated with 原值/新值/原因 notes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
103 lines
3.6 KiB
Python
103 lines
3.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Service entrypoint for the repo's financial-astrology skill."""
|
|
|
|
from __future__ import annotations
|
|
|
|
try: # reached as a script: this directory is on the path, the root is not
|
|
import _script_root # noqa: F401
|
|
except ModuleNotFoundError: # pragma: no cover - reached as scripts.x instead
|
|
try:
|
|
from scripts import _script_root # noqa: F401
|
|
except ModuleNotFoundError:
|
|
pass
|
|
|
|
|
|
import argparse
|
|
import json
|
|
from pathlib import Path
|
|
from typing import Any
|
|
|
|
from scripts.financial_astrology_reading_modes import build_reading_mode_packet
|
|
from scripts.market_astrology_benchmark_corpus_summary import summarize_corpus as summarize_benchmark_corpus
|
|
from scripts.market_astrology_multi_asset_corpus_summary import summarize_corpus as summarize_multi_asset_corpus
|
|
from scripts.market_astrology_runner import run_market_astrology_workflow
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
DEFAULT_SKILL_TEMPLATE_DIR = ROOT / "skills" / "financial-astrology" / "templates"
|
|
DEFAULT_MULTI_ASSET_CORPUS = ROOT / "references" / "market_research" / "market_astrology_benchmark_v2_multi_asset.json"
|
|
|
|
|
|
def _load_json(path: Path) -> Any:
|
|
return json.loads(path.read_text(encoding="utf-8"))
|
|
|
|
|
|
def run_example_workflow() -> dict[str, Any]:
|
|
return run_market_astrology_workflow(
|
|
market_profile=_load_json(DEFAULT_SKILL_TEMPLATE_DIR / "market-profile.example.json"),
|
|
astro_signals=_load_json(DEFAULT_SKILL_TEMPLATE_DIR / "astro-signals.example.json"),
|
|
price_series=_load_json(DEFAULT_SKILL_TEMPLATE_DIR / "price-series.example.json"),
|
|
labels=_load_json(DEFAULT_SKILL_TEMPLATE_DIR / "labels.example.json"),
|
|
benchmark=_load_json(DEFAULT_SKILL_TEMPLATE_DIR / "benchmark.example.json"),
|
|
)
|
|
|
|
|
|
def build_service_report(*, mode: str) -> dict[str, Any]:
|
|
if mode.startswith("reading:"):
|
|
route = mode.split(":", 1)[1]
|
|
reading_mode = build_reading_mode_packet(route=route)
|
|
return {
|
|
"schema": "jyotish.financial_astrology_service.v1",
|
|
"mode": mode,
|
|
"status": reading_mode.get("status", "blocked"),
|
|
"reading_mode": reading_mode,
|
|
}
|
|
if mode == "example":
|
|
result = run_example_workflow()
|
|
return {
|
|
"schema": "jyotish.financial_astrology_service.v1",
|
|
"mode": mode,
|
|
"status": result.get("status", "blocked"),
|
|
"workflow": result,
|
|
}
|
|
if mode == "multi_asset_corpus":
|
|
summary = summarize_multi_asset_corpus(DEFAULT_MULTI_ASSET_CORPUS)
|
|
return {
|
|
"schema": "jyotish.financial_astrology_service.v1",
|
|
"mode": mode,
|
|
"status": "ready",
|
|
"summary": summary,
|
|
}
|
|
summary = summarize_benchmark_corpus(ROOT / "references" / "market_research" / "market_astrology_benchmark_v1.json")
|
|
return {
|
|
"schema": "jyotish.financial_astrology_service.v1",
|
|
"mode": "benchmark_corpus",
|
|
"status": "ready",
|
|
"summary": summary,
|
|
}
|
|
|
|
|
|
def main() -> int:
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument(
|
|
"--mode",
|
|
choices=(
|
|
"example",
|
|
"benchmark_corpus",
|
|
"multi_asset_corpus",
|
|
"reading:market_turning_points",
|
|
"reading:asset_tempo",
|
|
"reading:trader_fit",
|
|
"reading:wealth_cycle",
|
|
"reading:event_window_check",
|
|
),
|
|
default="reading:market_turning_points",
|
|
)
|
|
args = parser.parse_args()
|
|
print(json.dumps(build_service_report(mode=args.mode), ensure_ascii=False, indent=2, sort_keys=True))
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|