@botfather/units-agent-service
v0.1.2
Published
Node HTTP service wrapper for Units agent UI compression.
Readme
@botfather/units-agent-service
HTTP service wrapper for agent-facing UI compression.
Install
npm install @botfather/units-agent-serviceQuick start
import { startUnitsAgentService } from "@botfather/units-agent-service";
const service = await startUnitsAgentService({
host: "127.0.0.1",
port: 8787,
libraryDir: ".units/library",
});
console.log(service.url); // http://127.0.0.1:8787Endpoints
GET /healthzPOST /compress-ui
Request payload for POST /compress-ui:
{
"tree": { "tagName": "div", "children": [] },
"sourceType": "dom",
"target": "planner",
"maxTokens": 600
}sourceType supports dom, a11y, ir, react, and slack. For Slack Block Kit, send the message payload or blocks array as tree with sourceType: "slack" (aliases: block-kit, blockkit, mrkdwn).
Response payload includes:
dslunitsAstprogramIdtokenEstimaterewrite/compilediagnostics
Exports
createUnitsAgentService(config)createUnitsAgentHttpHandler(config)startUnitsAgentService(config)
