diff --git a/agents/designer/README.md b/agents/designer/README.md new file mode 100644 index 000000000..a51f804d0 --- /dev/null +++ b/agents/designer/README.md @@ -0,0 +1,35 @@ +# @corbits/code-agent-designer + +## What this is + +Ready `@corbits/code-agent-designer` agent + independently importable components: +`agent`, `defineAgent`, `director`, `tools`, `systemPrompt`, `config`. + +## Consume (runLocal) + +```ts +import { agent } from "@corbits/code-agent-designer"; +const run = runLocal(defining(agent), env); +``` + +## Consume (deploy runWorkflow / hub / sidecar) + +Hand the same `AgentDefinition` to a workflow — the package never exports a +workflow itself. + +## Remix components + +```ts +import { director, tools, systemPrompt, config } from "@corbits/code-agent-designer"; +defineAgent({ director, ... }); // or swap tools / systemPrompt / config +``` + +Each of `director`, `tools`, `systemPrompt`, and `config` is a named, +independently importable part. + +## Single authority + +`prompt.ts` `systemPrompt.build()` is byte-stable (the raw card, no formatting). +`toolset.ts` `tools` literal equals the `REVIEW_TOOLS` surface constant in +`src/agent/directors/tool-sets.ts`; drift is enforced by the in-tree drift-guard +`src/agent/directors/designer/package.test.ts`. diff --git a/agents/designer/package.json b/agents/designer/package.json new file mode 100644 index 000000000..2779dd051 --- /dev/null +++ b/agents/designer/package.json @@ -0,0 +1,13 @@ +{ + "name": "@corbits/code-agent-designer", + "version": "0.1.0", + "private": true, + "type": "module", + "license": "SEE LICENSE IN LICENSE.md", + "exports": { + ".": { + "types": "./src/index.ts", + "default": "./src/index.ts" + } + } +} diff --git a/agents/designer/src/agent.ts b/agents/designer/src/agent.ts new file mode 100644 index 000000000..186d24e33 --- /dev/null +++ b/agents/designer/src/agent.ts @@ -0,0 +1,17 @@ +import { + defineAgent as coreDefineAgent, + type AgentDefinition, +} from "@intx/agent"; +import { systemPrompt } from "./prompt.js"; + +export const agent: AgentDefinition = defineAgent(); + +export function defineAgent(): AgentDefinition { + return coreDefineAgent({ + id: "designer", + systemPrompt: systemPrompt.build(), + tools: [], // tool mounting is consumer/app-side; surface enforced by drift-guard + capabilities: [], + inference: { sources: [] }, + }); +} diff --git a/agents/designer/src/config.ts b/agents/designer/src/config.ts new file mode 100644 index 000000000..7080c5b82 --- /dev/null +++ b/agents/designer/src/config.ts @@ -0,0 +1,9 @@ +export const config = { + spawn: { maySpawn: false }, + tier: "leaf", + modelRole: "implement", +} as const satisfies { + spawn: { maySpawn: boolean }; + tier: string; + modelRole: string; +}; diff --git a/agents/designer/src/director.ts b/agents/designer/src/director.ts new file mode 100644 index 000000000..214116ace --- /dev/null +++ b/agents/designer/src/director.ts @@ -0,0 +1,22 @@ +import { tools } from "./toolset.js"; +import { systemPrompt } from "./prompt.js"; +import { config } from "./config.js"; + +export const director = { + id: "designer", + primaryIntent: + "Own DESIGN.md create/use, design tokens, UI styling, and impeccable.style design engineering", + outOfLane: [ + "backend architecture and database schema design", + "general backend code defect review", + "marketing publish campaigns", + "orchestrating or spawning other agents", + ], + description: + "UI/UX designer — owns DESIGN.md, impeccable style design laws, tokens, and interface polish", + systemPrompt: systemPrompt.build(), + tools: { allow: [...tools] }, + spawn: config.spawn, + tier: config.tier, + modelRole: config.modelRole, +} as const; diff --git a/agents/designer/src/index.ts b/agents/designer/src/index.ts new file mode 100644 index 000000000..c2c15f6c6 --- /dev/null +++ b/agents/designer/src/index.ts @@ -0,0 +1,5 @@ +export { agent, defineAgent } from "./agent.js"; +export { director } from "./director.js"; +export { tools } from "./toolset.js"; +export { systemPrompt } from "./prompt.js"; +export { config } from "./config.js"; diff --git a/src/agent/directors/designer/package.ts b/agents/designer/src/prompt.ts similarity index 67% rename from src/agent/directors/designer/package.ts rename to agents/designer/src/prompt.ts index a3f73f68e..8b9dbe405 100644 --- a/src/agent/directors/designer/package.ts +++ b/agents/designer/src/prompt.ts @@ -1,28 +1,5 @@ -import type { DirectorPackage } from "../types.js"; -import { BUILD_TOOLS } from "../tool-sets.js"; - -/** - * Designer worker: UI/UX design engineering specialist. - * Owns DESIGN.md creation and updates, impeccable.style design laws, - * design tokens, typography, spatial layout, and micro-interaction polish. - */ -export const designerPackage: DirectorPackage = { - id: "designer", - primaryIntent: - "Own DESIGN.md create/use, design tokens, UI styling, and impeccable.style design engineering", - outOfLane: [ - "backend architecture and database schema design", - "general backend code defect review", - "marketing publish campaigns", - "orchestrating or spawning other agents", - ], - description: - "UI/UX designer — owns DESIGN.md, impeccable style design laws, tokens, and interface polish", - tools: { allow: BUILD_TOOLS }, - spawn: { maySpawn: false }, - tier: "leaf", - modelRole: "implement", - systemPrompt: `You are DesignerDirector (Designer), a specialist in Corbits Code. +// Designer card. Byte-stable build, single prompt authority. +const CARD = `You are DesignerDirector (Designer), a specialist in Corbits Code. PRIMARY INTENT: own interface design, design tokens, styling, and DESIGN.md. You bring design engineering excellence to UI surfaces — layout rhythm, typography, purposeful motion, responsive states, and cohesive design systems. @@ -44,5 +21,11 @@ Workflow: 3. Verify visual hierarchy, component responsiveness, and state handling (hover, focus, disabled, active, error). 4. Report changes with Summary / Findings / Blockers / Paths. -OUT OF LANE: backend business logic or database migrations, general backend defect review, marketing content pipelines, fleet orchestration.`, +OUT OF LANE: backend business logic or database migrations, general backend defect review, marketing content pipelines, fleet orchestration.`; + +export const theme = "designer"; + +export const systemPrompt = { + theme, + build: (): string => CARD, }; diff --git a/agents/designer/src/toolset.ts b/agents/designer/src/toolset.ts new file mode 100644 index 000000000..03d33ce03 --- /dev/null +++ b/agents/designer/src/toolset.ts @@ -0,0 +1,17 @@ +// BUILD_TOOLS literal (= REVIEW_TOOLS); drift-guarded against REVIEW_TOOLS +// by src/agent/directors/designer/package.test.ts. +export const tools = [ + "read_file", + "grep", + "search_files", + "list_dir", + "lsp", + "run_shell", + "web_fetch", + "web_search", + "skill_search", + "use_skill", + "write_file", + "edit_file", + "delete_file", +] as const; diff --git a/agents/designer/tsconfig.json b/agents/designer/tsconfig.json new file mode 100644 index 000000000..0d7100cbc --- /dev/null +++ b/agents/designer/tsconfig.json @@ -0,0 +1,7 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "noEmit": true + }, + "include": ["src/**/*.ts"] +} diff --git a/bun.lock b/bun.lock index 46e1bed4f..48ffba2f1 100644 --- a/bun.lock +++ b/bun.lock @@ -68,6 +68,10 @@ "name": "@corbits/code-agent-warden", "version": "0.1.0", }, + "agents/designer": { + "name": "@corbits/code-agent-designer", + "version": "0.1.0", + }, "packages/first-class-providers": { "name": "@corbits/first-class-providers", "version": "0.1.0", @@ -264,6 +268,7 @@ "@corbits/code-agent-prober": ["@corbits/code-agent-prober@workspace:agents/prober"], "@corbits/code-agent-dispatch": ["@corbits/code-agent-dispatch@workspace:agents/dispatch"], "@corbits/code-agent-warden": ["@corbits/code-agent-warden@workspace:agents/warden"], + "@corbits/code-agent-designer": ["@corbits/code-agent-designer@workspace:agents/designer"], "@corbits/codex-provider": ["@corbits/codex-provider@0.1.1", "", { "dependencies": { "arktype": "^2.2.3" }, "peerDependencies": { "@corbits/oauth-core": "^0.2.0", "@corbits/openai-responses": "^0.2.0", "@intx/inference": "^0.4.0", "@intx/types": "^0.4.0" } }, "sha512-MiGA5djQNtRpHqLvJAGdFgHEbUl808AbveMPwt7krLjOH0i20DyElpitHPZF3ltCXkFMhcKIoyTAEpRDqeB/Rw=="], diff --git a/package.json b/package.json index c427a0851..51e2ff5d6 100644 --- a/package.json +++ b/package.json @@ -108,7 +108,8 @@ "@modelcontextprotocol/sdk": "^1.29.0", "@opentui/core": "0.5.12", "arktype": "catalog:", - "isomorphic-git": "catalog:" + "isomorphic-git": "catalog:", + "@corbits/code-agent-designer": "workspace:*" }, "devDependencies": { "@intx/inference-testing": "0.3.0", diff --git a/scripts/dead-export-allowlist.txt b/scripts/dead-export-allowlist.txt index 0c6bcaf8f..21d45e8b3 100644 --- a/scripts/dead-export-allowlist.txt +++ b/scripts/dead-export-allowlist.txt @@ -51,6 +51,14 @@ agents/warden/src/index.ts: agent agents/warden/src/index.ts: defineAgent agents/warden/src/config.ts: satisfies agents/warden/src/config.ts: boolean +agents/designer/src/index.ts: agent +agents/designer/src/index.ts: defineAgent +agents/designer/src/index.ts: director +agents/designer/src/index.ts: tools +agents/designer/src/index.ts: systemPrompt +agents/designer/src/index.ts: config +agents/designer/src/config.ts: satisfies +agents/designer/src/config.ts: boolean # Versioned prompt-variance package public surface (CL-8269 lane, # agent-owned). Family rows data re-exported through the package entry point; diff --git a/src/agent/directors/designer/package.test.ts b/src/agent/directors/designer/package.test.ts new file mode 100644 index 000000000..9b3aaa94e --- /dev/null +++ b/src/agent/directors/designer/package.test.ts @@ -0,0 +1,49 @@ +import { describe, expect, test } from "bun:test"; + +import { + director, + tools, + config, + systemPrompt, +} from "@corbits/code-agent-designer"; +import { REVIEW_TOOLS } from "../tool-sets.js"; +import { DIRECTOR_REGISTRY } from "../registry.js"; +import type { DirectorPackage } from "../types.js"; + +describe("designerPackage", () => { + test("workspace package satisfies the director contract and feeds the registry", () => { + const asDirector: DirectorPackage = director; + expect(asDirector.id).toBe("designer"); + expect(DIRECTOR_REGISTRY.designer).toBe(director); + expect([...director.tools.allow]).toEqual([...REVIEW_TOOLS]); + expect(new Set(director.tools.allow).size).toBe( + director.tools.allow.length, + ); + }); + + test("spawn/tier/modelRole match config", () => { + expect(director.spawn).toEqual(config.spawn); + expect(director.tier).toBe(config.tier); + expect(director.modelRole).toBe(config.modelRole); + expect(director.spawn.maySpawn).toBe(false); + expect(director.tier).toBe("leaf"); + expect(director.modelRole).toBe("implement"); + }); + + test("prompt authority is byte-stable", () => { + expect(director.systemPrompt).toBe(systemPrompt.build()); + expect(systemPrompt.build()).toBe(systemPrompt.build()); + }); + + test("tools surface matches REVIEW_TOOLS and is leaf-scoped", () => { + expect([...tools]).toEqual([...REVIEW_TOOLS]); + expect(tools).not.toContain("spawn_agent"); + expect(tools).not.toContain("ask_operator"); + expect(tools).not.toContain("wait_agents"); + expect(tools).not.toContain("search_agents"); + }); + + test("tools allowlist has no duplicates", () => { + expect(new Set([...tools]).size).toBe(tools.length); + }); +}); diff --git a/src/agent/directors/registry.ts b/src/agent/directors/registry.ts index ddf5fc0b3..f3e6adbdf 100644 --- a/src/agent/directors/registry.ts +++ b/src/agent/directors/registry.ts @@ -2,10 +2,10 @@ import { director as shakespeareDirector } from "@corbits/code-agent-shakespeare import { director as proberDirector } from "@corbits/code-agent-prober"; import { director as dispatchDirector } from "@corbits/code-agent-dispatch"; import { director as wardenDirector } from "@corbits/code-agent-warden"; +import { director as designerDirector } from "@corbits/code-agent-designer"; import type { AgentProfile, CapabilityFilter } from "../profile-types.js"; import { director as artistDirector } from "@corbits/code-agent-artist"; import { coderPackage } from "./coder/package.js"; -import { designerPackage } from "./designer/package.js"; import { explorerPackage } from "./explorer/package.js"; import { plannerPackage } from "./planner/package.js"; import { qaLeadPackage } from "./qa-lead/package.js"; @@ -42,7 +42,7 @@ export const DIRECTOR_REGISTRY: Readonly> = planner: plannerPackage, coder: coderPackage, reviewer: reviewerPackage, - designer: designerPackage, + designer: designerDirector, artist: artistDirector, warden: wardenDirector, shakespeare: shakespeareDirector, diff --git a/tsconfig.json b/tsconfig.json index 10efbac6e..31455b6e4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,6 +10,7 @@ "@corbits/code-agent-prober": ["./agents/prober/src/index.ts"], "@corbits/code-agent-dispatch": ["./agents/dispatch/src/index.ts"], "@corbits/code-agent-warden": ["./agents/warden/src/index.ts"], + "@corbits/agent-designer": ["./agents/designer/src/index.ts"], "@corbits/provider-opencode-go": ["./packages/opencode-go/src/index.ts"], "@corbits/first-class-providers": [ "./packages/first-class-providers/src/index.ts"