feat: build & test relayflows core against @agent-relay 8.x

Merged
WI
4mo ago
+2643-1008

User description

Summary

Brings packages/core to a compiling, building state for the first time in this repo (it was imported from the relay monorepo mid-migration and never built here), migrates it off the removed v7 @agent-relay/sdk broker API onto @agent-relay/harness-driver 8.2, and rebrands the primitives to the @relayflows scope.

Depends on @agent-relay/harness-driver@8.2.0 (the SpawnedAgentHandle lifecycle primitive, added in AgentWorkforce/relay#1050).

Primitives

  • Rename @agent-relay/{github,slack,browser}-primitive → @relayflows/*, aligned to the 0.1.0 lineage. Updates core deps, imports, README, and the publish workflow's release notes + build order.

Core SDK migration (v7 → v8)

  • Broker surface swapped from the removed v7 AgentRelay to HarnessDriverClient: construction via HarnessDriverClient.spawn({ onStderr }); the 7 legacy named listeners rewritten as a single onEvent(BrokerEvent) dispatcher (the named event bus isn't fed in direct-client usage); spawnPty, listAgents/release, shutdown; idle-nudge via sendMessage.
  • Consumes the new SpawnedAgentHandle (waitForExit/waitForIdle/exitCode) through a thin local WorkflowAgentHandle wrapper that preserves the runner's existing string contract (so waitForExitWithIdleNudging is unchanged).
  • Vendored the deleted CLI utilities (getCliDefinition/resolveCliSync/resolveSpawnPolicy) into core/src/cli-registry.ts; stripAnsi → strip-ansi.
  • Bumped @agent-relay/{cloud,config,sdk,harness-driver,harnesses} to ^8.2.0; unified the repo on one SDK major (dropped browser-primitive's vestigial 7.1.1 pin).

✅ core + cli typecheck clean and build.

Tests — ⚠️ in progress (why this is a draft)

  • ✅ Repaired monorepo-era import paths (../workflows/*, ../../provisioner/*) and the builtin-templates path (yaml-validation: 0 → 143 passing).
  • ✅ Established + applied the HarnessDriverClient mock pattern: workflow-runner.test.ts 0 → 59/65, via a BrokerEvent-translating emitMockEvent shim + fail-fast reconciliation (the runner now defaults to strategy:'retry', so first-pass failure tests opt into fail-fast).
  • 🔧 Remaining: migrate the same mock shape across ~11 more broker-mock test files (they currently spawn real brokers), and reconcile the supervised/owner/review behavioral assertions to the current runner. These were broken on extraction from the monorepo, independent of the SDK change.

See docs/sdk-v8-migration-plan.md for the full plan and findings.

🤖 Generated with Claude Code


Summary by cubic

Migrated packages/core from v7 @agent-relay/sdk to @agent-relay/harness-driver@8.2, rebranded primitives to @relayflows/*, and brought the core test suite to green.

  • Refactors

    • Swapped v7 broker API for HarnessDriverClient with a single onEvent(BrokerEvent); preserved runner behavior via a WorkflowAgentHandle adapter over SpawnedAgentHandle.
    • Vendored CLI helpers (getCliDefinition, resolveCliSync, resolveSpawnPolicy) into core/src/cli-registry.ts; switched to strip-ansi. Updated integrations to @relayflows/* and publish order to build primitives first.
    • Minor cleanup: ignore **/.agent-relay/ in VCS and validate script file extensions before existence checks.
  • Tests

    • Repaired and migrated the suite to the new driver: mock HarnessDriverClient, use the runner’s executor seam to avoid real spawns, and reconcile to { reason } results and fail-fast behavior. Full suite passing.
    • Added vitest configs with a plugin to externalize the node:sqlite builtin and capped fork concurrency; updated trajectory path expectations and permission-audit path via @agent-relay/cloud’s getDefaultPermissionAuditPath.

CodeAnt-AI Description

Move core to the v8 agent runtime and rename the primitives to @relayflows

What Changed

  • Core now uses the v8 harness driver for agent spawning, lifecycle tracking, idle nudges, and broker events.
  • The workflow runner keeps the same user-facing behavior while handling the new agent handle format behind the scenes.
  • GitHub, Slack, and Browser primitives were renamed to the @relayflows/* package scope, and the publish workflow now builds them before core.
  • Workflow tests were updated to match the new runtime behavior, including fail-fast cases, review decisions, idle nudges, and trajectory file locations.

Impact

✅ Workflows run against the v8 agent runtime
✅ Fewer breakages from renamed packages
✅ Clearer workflow test coverage for retry, review, and idle behavior

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.