ESLint plugin (@cef-ai/eslint-plugin)
npm install -D @cef-ai/eslint-plugin@1.0.0 @typescript-eslint/parserThe plugin shows the checks cef build runs on agent code while you type. It needs ESLint 8 or later.
Configure
{ "parser": "@typescript-eslint/parser", "plugins": ["@cef-ai"], "extends": ["plugin:@cef-ai/recommended"], "rules": { "@cef-ai/cubby-declared-alias": ["error", { "aliases": ["history"] }], "@cef-ai/model-declared-alias": ["error", { "aliases": ["llm"] }] }}recommended turns on every agent rule below as an error.
Rules
| Rule | Checks | Options |
|---|---|---|
on-event-literal |
@OnEvent(…) takes a string literal. |
— |
engagement-id-literal |
@Engagement({ … }) has id and goal as string literals. |
— |
cubby-declared-alias |
ctx.cubby(…) takes a string literal naming a declared cubby. |
{ aliases: string[] } |
model-declared-alias |
ctx.models.X names a declared model. |
{ aliases: string[] } |
publish-declared-type |
Calls of the form ctx.publish(type, …) take a string literal in the declared set. It does not inspect ctx.vault.publish. |
{ knownEventTypes: string[] } |
no-banned-imports |
No Node built-ins and no sync database or network packages. | — |
Without options, the alias rules check only that the argument is a literal.
Banned imports
Node built-ins, with or without node:: fs, fs/promises, path, net, tls, dgram, dns, http, https, http2, child_process, worker_threads, cluster, os, process, readline, repl, vm, stream, zlib, buffer, crypto.
Packages: pg, pg-native, mysql, mysql2, mongodb, redis, ioredis, sqlite3, better-sqlite3, ws, node-fetch, axios.
Use the sandbox globals instead: fetch for HTTP, globalThis.crypto for WebCrypto, and ctx.cubby for storage.
Editor and build
| Check | Editor (plugin) | cef build |
|---|---|---|
Non-literal @OnEvent |
error | error |
| Undeclared model alias | error, when aliases is set |
error |
| Banned import | error | error |
Cubby alias not in the agent’s cubbies |
error, when aliases is set |
warning: the Agent Service may declare it |
| Computed cubby alias | error | warning |