diff --git a/agents/prober/README.md b/agents/prober/README.md new file mode 100644 index 000000000..84eee3bdc --- /dev/null +++ b/agents/prober/README.md @@ -0,0 +1,35 @@ +# @corbits/code-agent-prober + +## What this is + +Ready `@corbits/code-agent-prober` agent + independently importable components: +`agent`, `defineAgent`, `director`, `tools`, `systemPrompt`, `config`. + +## Consume (runLocal) + +```ts +import { agent } from "@corbits/code-agent-prober"; +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-prober"; +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/prober/package.test.ts`. diff --git a/agents/prober/package.json b/agents/prober/package.json new file mode 100644 index 000000000..0db73dbf1 --- /dev/null +++ b/agents/prober/package.json @@ -0,0 +1,13 @@ +{ + "name": "@corbits/code-agent-prober", + "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/prober/src/agent.ts b/agents/prober/src/agent.ts new file mode 100644 index 000000000..b9e59f6e4 --- /dev/null +++ b/agents/prober/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: "prober", + systemPrompt: systemPrompt.build(), + tools: [], + capabilities: [], + inference: { sources: [] }, + }); +} diff --git a/agents/prober/src/config.ts b/agents/prober/src/config.ts new file mode 100644 index 000000000..beb453084 --- /dev/null +++ b/agents/prober/src/config.ts @@ -0,0 +1,9 @@ +export const config = { + spawn: { maySpawn: false }, + tier: "leaf", + modelRole: "test", +} as const satisfies { + spawn: { maySpawn: boolean }; + tier: string; + modelRole: string; +}; diff --git a/agents/prober/src/director.ts b/agents/prober/src/director.ts new file mode 100644 index 000000000..219582290 --- /dev/null +++ b/agents/prober/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: "prober", + primaryIntent: + "Measure latency and behavior distributions per family/model; never ship product code, never tune prompts or policy", + outOfLane: [ + "shipping product code", + "tuning prompts or model-family policy", + "building a new eval harness", + "fleet orchestration", + "architecture essays without measurements", + ], + description: "Measure-only latency/behavior prober per family/model", + systemPrompt: systemPrompt.build(), + tools: { allow: [...tools] }, + spawn: config.spawn, + tier: config.tier, + modelRole: config.modelRole, +} as const; diff --git a/agents/prober/src/index.ts b/agents/prober/src/index.ts new file mode 100644 index 000000000..c2c15f6c6 --- /dev/null +++ b/agents/prober/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/prober/package.ts b/agents/prober/src/prompt.ts similarity index 74% rename from src/agent/directors/prober/package.ts rename to agents/prober/src/prompt.ts index d089ffe3d..917d4c52b 100644 --- a/src/agent/directors/prober/package.ts +++ b/agents/prober/src/prompt.ts @@ -1,24 +1,6 @@ -import type { DirectorPackage } from "../types.js"; -import { REVIEW_TOOLS } from "../tool-sets.js"; +// The app formats the identity header via formatDirectorSystemPrompt. -/** - * Prober worker (CL-7656). - * Measure-only latency/behavior prober — report distributions per - * family/model; never ship product code, never tune prompts or policy. - */ -export const proberPackage: DirectorPackage = { - id: "prober", - primaryIntent: - "Measure latency and behavior distributions per family/model; never ship product code, never tune prompts or policy", - outOfLane: [ - "shipping product code", - "tuning prompts or model-family policy", - "building a new eval harness", - "fleet orchestration", - "architecture essays without measurements", - ], - description: "Measure-only latency/behavior prober per family/model", - systemPrompt: `You are ProberDirector (Prober), a specialist in Corbits Code. +const CARD = `You are ProberDirector (Prober), a specialist in Corbits Code. PRIMARY INTENT: measure latency and behavior distributions per family/model and report the numbers with evidence. Never ship product code. Never tune prompts or model-family policy. Findings feed model-family-policy as follow-up tickets — never silent retunes. @@ -67,9 +49,9 @@ retunes, or orchestration. OUT OF LANE: shipping product code, tuning prompts or model-family policy (route to follow-up tickets), building a new harness, fleet -orchestration, architecture essays without measurements.`, - tools: { allow: REVIEW_TOOLS }, - spawn: { maySpawn: false }, - tier: "leaf", - modelRole: "test", +orchestration, architecture essays without measurements.`; + +export const systemPrompt = { + theme: "prober", + build: (): string => CARD, }; diff --git a/agents/prober/src/toolset.ts b/agents/prober/src/toolset.ts new file mode 100644 index 000000000..d8041a3ef --- /dev/null +++ b/agents/prober/src/toolset.ts @@ -0,0 +1,15 @@ +export const tools: readonly string[] = [ + "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/prober/tsconfig.json b/agents/prober/tsconfig.json new file mode 100644 index 000000000..0d7100cbc --- /dev/null +++ b/agents/prober/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 71a4669c4..84d0c2a99 100644 --- a/bun.lock +++ b/bun.lock @@ -55,6 +55,9 @@ }, "agents/shakespeare": { "name": "@corbits/code-agent-shakespeare", + }, + "agents/prober": { + "name": "@corbits/code-agent-prober", "version": "0.1.0", }, "packages/first-class-providers": { @@ -250,6 +253,7 @@ "@corbits/code-agent-artist": ["@corbits/code-agent-artist@workspace:agents/artist"], "@corbits/code-agent-shakespeare": ["@corbits/code-agent-shakespeare@workspace:agents/shakespeare"], + "@corbits/code-agent-prober": ["@corbits/code-agent-prober@workspace:agents/prober"], "@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/scripts/dead-export-allowlist.txt b/scripts/dead-export-allowlist.txt index bf9856198..0003b259a 100644 --- a/scripts/dead-export-allowlist.txt +++ b/scripts/dead-export-allowlist.txt @@ -65,3 +65,7 @@ agents/shakespeare/src/index.ts: agent agents/shakespeare/src/index.ts: defineAgent agents/shakespeare/src/config.ts: satisfies agents/shakespeare/src/config.ts: boolean +agents/prober/src/index.ts: agent +agents/prober/src/index.ts: defineAgent +agents/prober/src/config.ts: satisfies +agents/prober/src/config.ts: boolean diff --git a/scripts/dead-export-guard.json b/scripts/dead-export-guard.json index 9b2bf9e8f..e29ca9e6c 100644 --- a/scripts/dead-export-guard.json +++ b/scripts/dead-export-guard.json @@ -1,5 +1,5 @@ { "tsconfig": "tsconfig.json", "tsPruneArgs": ["-p", "tsconfig.json"], - "minScannedFiles": 1130 + "minScannedFiles": 1240 } diff --git a/src/agent/directors/prober/package.test.ts b/src/agent/directors/prober/package.test.ts new file mode 100644 index 000000000..ec1b9f3ac --- /dev/null +++ b/src/agent/directors/prober/package.test.ts @@ -0,0 +1,47 @@ +import { describe, expect, test } from "bun:test"; + +import { + director, + tools, + config, + systemPrompt, +} from "@corbits/code-agent-prober"; +import { REVIEW_TOOLS } from "../tool-sets.js"; +import { DIRECTOR_REGISTRY } from "../registry.js"; +import type { DirectorPackage } from "../types.js"; + +describe("proberPackage", () => { + test("workspace package satisfies the director contract and feeds the registry", () => { + const asDirector: DirectorPackage = director; + expect(asDirector.id).toBe("prober"); + expect(DIRECTOR_REGISTRY.prober).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); + }); + + test("prompt authority is byte-stable", () => { + expect(director.systemPrompt).toBe(systemPrompt.build()); + expect(systemPrompt.build()).toBe(systemPrompt.build()); + }); + + test("tools surface matches the tool-sets constant 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 2c5ed6b65..688db63e4 100644 --- a/src/agent/directors/registry.ts +++ b/src/agent/directors/registry.ts @@ -1,4 +1,5 @@ import { director as shakespeareDirector } from "@corbits/code-agent-shakespeare"; +import { director as proberDirector } from "@corbits/code-agent-prober"; import type { AgentProfile, CapabilityFilter } from "../profile-types.js"; import { director as artistDirector } from "@corbits/code-agent-artist"; import { coderPackage } from "./coder/package.js"; @@ -6,7 +7,6 @@ import { designerPackage } from "./designer/package.js"; import { dispatchPackage } from "./dispatch/package.js"; import { explorerPackage } from "./explorer/package.js"; import { plannerPackage } from "./planner/package.js"; -import { proberPackage } from "./prober/package.js"; import { qaLeadPackage } from "./qa-lead/package.js"; import { reviewerPackage } from "./reviewer/package.js"; import { wardenPackage } from "./warden/package.js"; @@ -46,7 +46,7 @@ export const DIRECTOR_REGISTRY: Readonly> = artist: artistDirector, warden: wardenPackage, shakespeare: shakespeareDirector, - prober: proberPackage, + prober: proberDirector, "qa-lead": qaLeadPackage, }; diff --git a/tsconfig.json b/tsconfig.json index df0b1cca4..c7e3946b1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,6 +7,7 @@ "paths": { "@corbits/code-agent-artist": ["./agents/artist/src/index.ts"], "@corbits/code-agent-shakespeare": ["./agents/shakespeare/src/index.ts"], + "@corbits/code-agent-prober": ["./agents/prober/src/index.ts"], "@corbits/provider-opencode-go": ["./packages/opencode-go/src/index.ts"], "@corbits/first-class-providers": [ "./packages/first-class-providers/src/index.ts"