WP-0004: ecosystem integration complete
Add Helix Forge correlation (HELIX_SESSION_UID env, metrics correlate), artifact-store publish (metrics publish), activity-core ActivityDefinition references, integration patterns docs, and canon/knowledge design artifacts.
This commit is contained in:
@@ -11,6 +11,12 @@ from typing import List, Optional
|
||||
|
||||
from .registry import AgentRegistry, AgentCategory
|
||||
from .installer import AgentInstaller, ProjectInitializer, InstallationConfig
|
||||
from .integrations.artifact_store import (
|
||||
default_api_token,
|
||||
default_api_url,
|
||||
publish_optimizer_evidence,
|
||||
)
|
||||
from .integrations.helix import HelixCorrelationAdapter, enrich_helix_correlation
|
||||
from .metrics import MetricsStore, OptimizerStore, performance_summary_markdown
|
||||
from .optimization import OptimizationLoop, MIN_SAMPLES_FOR_RECOMMENDATIONS
|
||||
|
||||
@@ -999,6 +1005,8 @@ def metrics_record(
|
||||
if session_id:
|
||||
payload["session_id"] = session_id
|
||||
|
||||
payload = enrich_helix_correlation(payload)
|
||||
|
||||
if store.append(payload, idempotency_key=idempotency_key):
|
||||
click.echo(f"Recorded metrics for '{agent_name}'")
|
||||
else:
|
||||
@@ -1106,6 +1114,84 @@ def metrics_optimize(agent_name: Optional[str], target: str, min_samples: int):
|
||||
click.echo(f"Wrote optimizer analysis: {analysis_path}")
|
||||
|
||||
|
||||
@metrics.command("correlate")
|
||||
@click.argument("session_uid")
|
||||
@click.option(
|
||||
"--store-db",
|
||||
envvar="HELIX_STORE_DB",
|
||||
help="Helix Forge session-memory SQLite database path",
|
||||
)
|
||||
def metrics_correlate(session_uid: str, store_db: Optional[str]):
|
||||
"""Look up Helix Forge digest summary for a session UID (read-only)."""
|
||||
adapter = HelixCorrelationAdapter(
|
||||
store_db=Path(store_db).resolve() if store_db else None
|
||||
)
|
||||
if adapter.store_db is None:
|
||||
adapter = HelixCorrelationAdapter.from_env()
|
||||
summary = adapter.lookup(session_uid)
|
||||
click.echo(json.dumps(summary, indent=2, sort_keys=True))
|
||||
|
||||
|
||||
@metrics.command("publish")
|
||||
@click.option("--target", "-t", default=".", help="Project root (default: current)")
|
||||
@click.option(
|
||||
"--api-url",
|
||||
default=default_api_url,
|
||||
show_default=True,
|
||||
help="artifact-store API base URL (ARTIFACTSTORE_API_URL)",
|
||||
)
|
||||
@click.option(
|
||||
"--token",
|
||||
default=default_api_token,
|
||||
help="artifact-store bearer token (ARTIFACTSTORE_API_TOKEN)",
|
||||
)
|
||||
@click.option(
|
||||
"--subject",
|
||||
help="Package subject (default: project directory name)",
|
||||
)
|
||||
@click.option(
|
||||
"--retention-class",
|
||||
default="raw-evidence",
|
||||
show_default=True,
|
||||
help="artifact-store retention class",
|
||||
)
|
||||
def metrics_publish(
|
||||
target: str,
|
||||
api_url: str,
|
||||
token: str,
|
||||
subject: Optional[str],
|
||||
retention_class: str,
|
||||
):
|
||||
"""Publish optimizer evidence to artifact-store (optional integration)."""
|
||||
project_root = _project_root(target)
|
||||
if not token:
|
||||
click.echo(
|
||||
"Error: artifact-store token required. Set ARTIFACTSTORE_API_TOKEN or --token.",
|
||||
err=True,
|
||||
)
|
||||
sys.exit(1)
|
||||
try:
|
||||
result = publish_optimizer_evidence(
|
||||
project_root,
|
||||
api_url=api_url,
|
||||
token=token,
|
||||
subject=subject,
|
||||
retention_class=retention_class,
|
||||
)
|
||||
except FileNotFoundError as exc:
|
||||
click.echo(f"Error: {exc}", err=True)
|
||||
sys.exit(1)
|
||||
except RuntimeError as exc:
|
||||
click.echo(f"Error: {exc}", err=True)
|
||||
sys.exit(1)
|
||||
|
||||
click.echo(f"Published optimizer evidence package: {result.package_id}")
|
||||
click.echo(f" Files uploaded: {result.files_uploaded}")
|
||||
click.echo(f" Retention class: {result.retention_class}")
|
||||
if result.manifest_digest:
|
||||
click.echo(f" Manifest digest: {result.manifest_digest}")
|
||||
|
||||
|
||||
@metrics.command("export")
|
||||
@click.argument("agent_name")
|
||||
@click.option("--target", "-t", default=".", help="Project root (default: current)")
|
||||
|
||||
Reference in New Issue
Block a user