Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Trajectory: Remove personas from @agent-relay/sdk

> **Status:** ✅ Completed
> **Task:** GH-997
> **Confidence:** 86%
> **Started:** May 27, 2026 at 05:22 AM
> **Completed:** May 27, 2026 at 05:33 AM

---

## Summary

Removed SDK persona loading, spawn, dry-run, exports, dependency, tests, and example; updated migration notes and ensured SDK builds remove stale persona dist outputs before packing.

**Approach:** Standard approach

---

## Key Decisions

### Removed SDK-owned persona APIs instead of relocating them in this repo

- **Chose:** Removed SDK-owned persona APIs instead of relocating them in this repo
- **Reasoning:** Issue 997 asks for @agent-relay/sdk to know nothing about personas; there is already a separate packages/personas pack, while persona execution side effects should be owned by AgentWorkforce CLI or a workforce package.

### Removed stale persona dist artifacts during SDK builds

- **Chose:** Removed stale persona dist artifacts during SDK builds
- **Reasoning:** Deleting the source and package export is not enough if an existing dist/personas.js survives a package-level build; the SDK build now deletes the persona outputs before compiling so npm pack cannot include them.

---

## Chapters

### 1. Work

_Agent: default_

- Removed SDK-owned persona APIs instead of relocating them in this repo: Removed SDK-owned persona APIs instead of relocating them in this repo
- Removed stale persona dist artifacts during SDK builds: Removed stale persona dist artifacts during SDK builds

---

## Artifacts

**Commits:** 6a456b7f
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{
"id": "traj_kbxzde45cjlw",
"version": 1,
"task": {
"title": "Remove personas from @agent-relay/sdk",
"source": {
"system": "plain",
"id": "GH-997"
}
},
"status": "completed",
"startedAt": "2026-05-27T09:22:37.342Z",
"completedAt": "2026-05-27T09:33:18.299Z",
"agents": [
{
"name": "default",
"role": "lead",
"joinedAt": "2026-05-27T09:27:46.189Z"
}
],
"chapters": [
{
"id": "chap_m2xsvvdw25ze",
"title": "Work",
"agentName": "default",
"startedAt": "2026-05-27T09:27:46.189Z",
"endedAt": "2026-05-27T09:33:18.299Z",
"events": [
{
"ts": 1779874066190,
"type": "decision",
"content": "Removed SDK-owned persona APIs instead of relocating them in this repo: Removed SDK-owned persona APIs instead of relocating them in this repo",
"raw": {
"question": "Removed SDK-owned persona APIs instead of relocating them in this repo",
"chosen": "Removed SDK-owned persona APIs instead of relocating them in this repo",
"alternatives": [],
"reasoning": "Issue 997 asks for @agent-relay/sdk to know nothing about personas; there is already a separate packages/personas pack, while persona execution side effects should be owned by AgentWorkforce CLI or a workforce package."
},
"significance": "high"
},
{
"ts": 1779874377461,
"type": "decision",
"content": "Removed stale persona dist artifacts during SDK builds: Removed stale persona dist artifacts during SDK builds",
"raw": {
"question": "Removed stale persona dist artifacts during SDK builds",
"chosen": "Removed stale persona dist artifacts during SDK builds",
"alternatives": [],
"reasoning": "Deleting the source and package export is not enough if an existing dist/personas.js survives a package-level build; the SDK build now deletes the persona outputs before compiling so npm pack cannot include them."
},
"significance": "high"
}
]
}
],
"retrospective": {
"summary": "Removed SDK persona loading, spawn, dry-run, exports, dependency, tests, and example; updated migration notes and ensured SDK builds remove stale persona dist outputs before packing.",
"approach": "Standard approach",
"confidence": 0.86
},
"commits": ["6a456b7f"],
"filesChanged": [],
"projectId": "/Users/will/Projects/AgentWorkforce/relay",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Remove absolute local path from committed trajectory metadata.

projectId currently leaks a developer-local filesystem path (/Users/will/...). Replace it with a repo-stable identifier (or omit it) to avoid exposing local user/environment details in version control.

Suggested fix
-  "projectId": "/Users/will/Projects/AgentWorkforce/relay",
+  "projectId": "agentworkforce/relay",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"projectId": "/Users/will/Projects/AgentWorkforce/relay",
"projectId": "agentworkforce/relay",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
@.agentworkforce/trajectories/completed/2026-05/traj_kbxzde45cjlw/trajectory.json
at line 63, The committed trajectory.json contains a local absolute path in the
"projectId" field which leaks developer environment data; update the "projectId"
key value to a repo-stable identifier (e.g., a project slug, UUID, or remove the
key entirely) instead of "/Users/will/Projects/AgentWorkforce/relay" so the file
contains no user-specific filesystem paths; ensure any consumers of projectId
(e.g., code that reads trajectory metadata) still handle the new identifier or
absence of the field.

"tags": [],
"_trace": {
"startRef": "3f2a3f9cd27b5d978e39d07302cf1c2f34ab85de",
"endRef": "3f2a3f9cd27b5d978e39d07302cf1c2f34ab85de"
}
}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Breaking Changes

- `@agent-relay/sdk` swaps `@agentworkforce/harness-kit` + `@agentworkforce/workload-router` for `@agentworkforce/persona-kit@^3`. The persona tier system, the `tier` option on `spawnPersona`, the legacy relay-side `PersonaFile` / `PersonaTier` / `PersonaTierSpec` / `ResolvedPersona` / `PersonaSpawnSpec` / `MaterializedConfigFile` types, and the `buildPersonaSpawnSpec` / `materializePersonaConfigFiles` / `restorePersonaConfigFiles` helpers are removed. `loadPersona` now returns the canonical `PersonaSpec`, and `spawnPersona({ persona })` takes a `PersonaSpec` instead of a resolved persona.
- `@agent-relay/sdk` removes persona support from the SDK surface: the `./personas` subpath, persona helper/type exports, `AgentRelay.spawnPersona()`, `AgentRelay.getPersonaSpawnPlan()`, and `AgentRelayOptions.personaDirs` are gone. The SDK no longer depends on `@agentworkforce/persona-kit`.
- `agent-relay-broker`'s public Rust protocol types now require typed ID newtypes (`WorkerName`, `DeliveryId`, `EventId`, `WorkspaceId`, `WorkspaceAlias`, `ThreadId`, `AgentId`, `RequestId`, `ChannelName`, `MessageTarget`) on every protocol struct and enum variant in `protocol.rs`, `types.rs`, and `listen_api.rs::ListenApiRequest`. The new wrappers live in `crates/broker/src/lib.rs` under `pub mod ids`. JSON wire format is unchanged because every wrapper is `#[serde(transparent)]`, so the broker ↔ SDK channel and on-disk persisted state remain byte-compatible.
- `agent-relay spawn` and SDK spawn calls now return harness `sessionId` metadata for resumable Claude and Codex PTY sessions.
- `sdk-swift`: renamed the broker client class `RelayCast` → `AgentRelayClient`.
Expand All @@ -33,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Personas relying on `tiers.*` need to be flattened to a single top-level `harness` / `model` / `systemPrompt`. The shape that persona-kit (and the `agentworkforce` CLI) consumes is now the only supported shape.
- Callers that previously used `spawnPersona` to "just launch the harness" — without persona-kit's skill / mount / sidecar side effects — should use `AgentRelay.getPersonaSpawnPlan(id)` to inspect the plan and call `spawnPty` with the plan's `cli` + `args` themselves.
- Launch personas through the owning CLI or package and pass the resulting command to `relay.spawnPty(...)` or the SDK's headless provider APIs; for AgentWorkforce personas, use `npx agentworkforce persona run <id>` once available so persona side effects remain CLI-owned.
- Downstream Rust callers must construct identifiers via `relay_broker::ids::{WorkerName, DeliveryId, EventId, MessageTarget, …}` instead of `String`. Each newtype impls `From<String>` / `From<&str>` and `Deref<Target = str>`, so most string-handling code keeps compiling; only construction sites (`HashMap` keys, struct literals, channel sends) need updates.
- Replace ad-hoc target discrimination (`target.starts_with('#')`, `target == "thread"`) with `MessageTarget::kind()` and match on `MessageTargetKind::{Channel, Thread, DirectMessage, Conversation, Worker}`.
- `sdk-swift`: replace `RelayCast(apiKey:baseURL:)` with `AgentRelayClient(apiKey:baseURL:)`. The public API surface is otherwise unchanged.
Expand Down
22 changes: 0 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
"import": "./dist/relay.js",
"default": "./dist/relay.js"
},
"./personas": {
"types": "./dist/personas.d.ts",
"import": "./dist/personas.js",
"default": "./dist/personas.js"
},
"./logs": {
"types": "./dist/logs.d.ts",
"import": "./dist/logs.js",
Expand Down Expand Up @@ -131,7 +126,7 @@
},
"scripts": {
"prebuild": "npm --prefix ../github-primitive run build && npm --prefix ../slack-primitive run build && npm --prefix ../config run build && npm --prefix ../cloud run build",
"build": "npx tsc -p tsconfig.build.json",
"build": "node -e \"const fs=require('fs');for(const f of ['dist/personas.js','dist/personas.js.map','dist/personas.d.ts','dist/personas.d.ts.map'])fs.rmSync(f,{force:true})\" && npx tsc -p tsconfig.build.json",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Instead of targeting and deleting only the specific stale personas build artifacts, it is generally safer and more robust to clean the entire dist directory before running the TypeScript compiler. This prevents any other stale, renamed, or deleted files from persisting in the build output and potentially being packaged/published.

We can simplify the command by recursively removing the dist directory using Node's built-in fs.rmSync.

Suggested change
"build": "node -e \"const fs=require('fs');for(const f of ['dist/personas.js','dist/personas.js.map','dist/personas.d.ts','dist/personas.d.ts.map'])fs.rmSync(f,{force:true})\" && npx tsc -p tsconfig.build.json",
"build": "node -e \"require('fs').rmSync('dist', {recursive: true, force: true})\" && npx tsc -p tsconfig.build.json",

"build:full": "tsc -p tsconfig.json && npm run bundle:binary",
"bundle:binary": "node ./scripts/bundle-agent-relay.mjs",
"check": "tsc -p tsconfig.json --noEmit",
Expand All @@ -153,7 +148,6 @@
"@agent-relay/config": "7.1.1",
"@agent-relay/github-primitive": "7.1.1",
"@agent-relay/slack-primitive": "7.1.1",
"@agentworkforce/persona-kit": "^3.0.20",
"@relaycast/sdk": "^1.1.0",
"@relayfile/sdk": ">=0.1.2 <1",
"@sinclair/typebox": "^0.34.48",
Expand Down
Loading
Loading