feat(agentswarm): M1+M3 — embeddable swarm runtime wrapping deepagents

@logicsrc/agentswarm: a self-hosted, framework-agnostic multi-agent runtime
that each app mounts on its own route (e.g. tronbrowser.dev/swarm).

M1 — core:
- createSwarmHandler(): Web (Request)=>Response handler, CORS + validation
- SwarmRunner: injectable engine interface
- createDeepAgentRunner(): deepagents (createDeepAgent) adapter; deepagents +
  @langchain/langgraph are optional peers loaded via dynamic import so the core
  builds/tests with zero heavy deps
- SwarmError + onRequest gate: seam for x402 metering / auth (402/403)

M3 — rubric self-check (deepagents RubricMiddleware is Python-only, so ported
at the runner layer):
- createRubricRunner(): grades output via an injectable judge and revises until
  it passes or maxIterations; passes through untouched when no rubric
- createLLMJudge(): cheap-model grader (lazy langchain initChatModel)

13/13 vitest pass; tsc clean; examples/server.mjs demo verified.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Anthony Ettinger 2026-06-25 17:41:49 +00:00
parent ffe37a01ce
commit 018a583a00
13 changed files with 805 additions and 1 deletions

View file

@ -0,0 +1,25 @@
{
"name": "@logicsrc/agentswarm",
"version": "0.1.0",
"description": "AgentSwarm: embeddable multi-agent swarm runtime for LogicSRC, wrapping deepagents. Mount it on your own route (e.g. /swarm).",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"license": "MIT",
"scripts": {
"build": "tsc -p tsconfig.json",
"test": "vitest run src --passWithNoTests",
"demo": "node examples/server.mjs"
},
"peerDependencies": {
"@langchain/langgraph": "*",
"deepagents": "^1.10.0"
},
"peerDependenciesMeta": {
"@langchain/langgraph": { "optional": true },
"deepagents": { "optional": true }
},
"devDependencies": {
"vitest": "^4.0.8"
}
}